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
Throwing an SSR error for svelte third-party packages with npm protocol #293
Comments
cc: @JustinVoitel (maintainer of |
I've also noticed that I am able to notice a similar issue with files from within 21:20:02 [vite] Error when evaluating SSR module /src/lib/components/Navbar.svelte:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" for /Users/dexter/projects/svelte/reg/node_modules/.pnpm/svelte-hero-icons@4.0.3/node_modules/svelte-hero-icons/Icon.svelte
at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15)
at Loader.getFormat (internal/modules/esm/loader.js:102:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:231:31)
at async ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:58:21)
at async Promise.all (index 230)
at async link (internal/modules/esm/module_job.js:63:9) Even though I am importing correctly: <script>
import Navbar from '$lib/components/Navbar.svelte';
import '../tailwind.css';
</script>
<Navbar />
<slot /> Edit: It seems to be an issue with wherever is using an aliased package |
|
@bluwy This is definitely an edgecase issue. Please checkout the issue on the package's repo for extra context. It seems like:
Seems to error whereas:
Does not error. |
Ah looks like that's it. I didn't notice the |
here we compare the name field in package.json with the key in "dependencies":
this would not work for renamed packages. We have to validate it though because there may be other package.json files in the tree. not sure why
@dextermb is removing one hyphen from svelte-hero-icons just a simplified reproduction or literally what you want to achieve? |
Hey, thanks for following up. Removing the single hyphen is what I wanted to achieve. Background: "Heroicons" branding is one word, whereas the package says it's two. The original author says he didn't realise the branding when he made the package haha... |
What is the best workaround until this is fixed? I'm getting this error and can't use flowbite-svelte while this issue exists:
Here my full report with reproduction: themesberg/flowbite-svelte#86 |
I did try to use this workaround by setting:
but it did not work. I'm still getting the same error. |
@Spenhouet this issue is very specific about using the the library you posted I recommend you check out unplugin-icons, unocss with preset-icons or iconify's svelte integration instead as they are more customizable and you get access to all icons on https://icones.js.org |
Thanks for the reply but I'm actually not using |
bug them? |
You mean?: themesberg/flowbite-svelte#86 Sure, just wanted to make sure who's the one who needs to get active. |
or use it properly. Anyways please don't use this bug to chat. your messages are off-topic here. The svelte discord https://svelte.dev/chat can be used to ask for help ( #svelte ). From what i've seen the author of svelte-heros is active there too, |
Describe the bug
When hot reloading and initially spinning up
pnpm run dev
an error that causes a 500 message to be displayed to the client is seen when attempting to import a.svelte
component from anode_module
.Reproduction
dextermb/bug-hero-icons-svelte-kit
Steps to reproduce:
pnpm init svelte@next app
pnpm i -D svelte-heroicons@npm:svelte-hero-icons
pnpm run dev
Logs
System Info
Severity
serious, but I can work around it
Additional Information
Seems to work fine in
@sveltejs/kit:1.0.0-next.285
but not1.0.0-next.292
.Edit: After further investigation it seems like it could be down to aliased modules.
The text was updated successfully, but these errors were encountered: