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

SvelteKit Error #775

Closed
kane81 opened this issue Sep 22, 2021 · 3 comments
Closed

SvelteKit Error #775

kane81 opened this issue Sep 22, 2021 · 3 comments

Comments

@kane81
Copy link

kane81 commented Sep 22, 2021

Hi,

I tried using svelte-awesome in a SvelteKit project

<script>
	import Icon from 'svelte-awesome';
	import { beer } from 'svelte-awesome/icons';
</script>

<Icon data={beer} />

and get the following errors

Failed to fetch dynamically imported module: http://localhost:3000/src/routes/index.svelte
TypeError: Failed to fetch dynamically imported module: http://localhost:3000/src/routes/index.svelte

Uncaught (in promise) TypeError: Failed to fetch
index.js:556 GET http://localhost:3000/node_modules/svelte-awesome/icons/buysellads.js?v=4e79ebf0 net::ERR_FAILED

I tried

import Icon from 'svelte-awesome/components/Icon.svelte'

but it didnt work either....

@RobBrazier
Copy link
Owner

Can you try disabling your adblocker if you have one - chances are that's the cause for buysellads.js being blocked

When is this happening? when you run npm run dev / svelte-kit dev?

I'm seeing the same error when I run it with dev, but works absolutely fine when I do npm run build, then npm run preview - I can only assume it's something to do with the hmr.

@RobBrazier
Copy link
Owner

yep - that's the issue, adblock is blocking buysellads.js, which svelte doesn't like.

@benmccann
Copy link
Contributor

Oh man, I hit this and it was impossible to figure out. There's a new experimental.prebundleSvelteLibraries option that will allow you to work around this. Hopefully it will be set by default in the future

https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#prebundleSvelteLibraries

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