Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte Kit can't find @beyonk/svelte-mapbox #45

Closed
guttenbergovitz opened this issue Apr 9, 2021 · 4 comments
Closed

Svelte Kit can't find @beyonk/svelte-mapbox #45

guttenbergovitz opened this issue Apr 9, 2021 · 4 comments

Comments

@guttenbergovitz
Copy link

TBH I have no clue what is the source of the problem && it seems a bit awkward, but let me ask anyway...

Initially been struggling with #44 but after tweaking optimizeDeps as adviced it went away. So far so good.

But right now it seems an app doesn't see @beyonk/svelte-mapbox at all... Installed it as a dev dependency using both yarn and npm, removed node_modules & locks, reinstalled, upgraded all deps, did it once again - same thing over and over again.

Constantly getting Cannot find module '@beyonk/svelte-mapbox'.

I am really puzzled... Any ideas?

@guttenbergovitz guttenbergovitz changed the title Svelte Kit can't fint @beyonk/svelte-mapbox Svelte Kit can't find @beyonk/svelte-mapbox Apr 9, 2021
@guttenbergovitz
Copy link
Author

Mm... not entirely sure how Svelte Kit threats @ at the beginning of import but it seems when I did import from ../../node_nodules/@beyonk/svelte-mapbox it somehow worked.

Somehow as i got:

[vite] Error when evaluating SSR module /node_modules/fastq/queue.js?v=08ad58e2:
ReferenceError: require is not defined
    at /node_modules/fastq/queue.js?v=08ad58e2:3:15
    at instantiateModule (/Users/krzysztofkrzys/Projects/StoreLocator/storelocator-kit/node_modules/vite/dist/node/chunks/dep-66eb515d.js:69030:166)

@guttenbergovitz
Copy link
Author

So we're back in fastq issue...

@sjmcdowall
Copy link

I was wondering the same thing -- but I used this path instead (which appears to work -- but not sure if its a good method)

	import Map from '@beyonk/svelte-mapbox/src/Map.svelte';
	import Marker from '@beyonk/svelte-mapbox/src/Marker.svelte';

I remember reading somewhere (smelte) that the above maybe more effecient anyway for vite to build later? Not sure --

As for the fastq that is solved (another issue already) via the svelte.config.cjs vite options:

	vite: {
		ssr: {},
		optimizeDeps: {
			include: ['fastq'] // 👈 For svelte-mapbox
		},
		plugins: []
	...

@guttenbergovitz
Copy link
Author

Thank you. I have rune with similar issue with Swiper and this direct.svelte import did the trick for SvelteKit and SSR. TBH I have noticed that good reference for similar issues are ones faced by Sapper people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants