Throwing an SSR error for svelte third-party packages with npm protocol
See original GitHub issueDescribe 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 a node_module.
Reproduction
dextermb/bug-hero-icons-svelte-kit
Steps to reproduce:
pnpm init svelte@next apppnpm i -D svelte-heroicons@npm:svelte-hero-icons- Import icon into page
pnpm run dev
Logs
18:29:23 [vite] Error when evaluating SSR module /src/routes/index.svelte:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" for /Users/dexter/projects/svelte/hero-icons-svelte-kit/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)
System Info
npx: installed 1 in 1.125s
System:
OS: macOS 12.2.1
CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
Memory: 50.17 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
Yarn: 1.22.10 - ~/.nvm/versions/node/v14.16.0/bin/yarn
npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
Browsers:
Brave Browser: 97.1.34.81
Chrome: 99.0.4844.51
Firefox: 94.0.1
Safari: 15.3
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.30
@sveltejs/kit: next => 1.0.0-next.292
svelte: ^3.44.0 => 3.46.4
Severity
serious, but I can work around it
Additional Information
Seems to work fine in @sveltejs/kit:1.0.0-next.285 but not 1.0.0-next.292.
Edit: After further investigation it seems like it could be down to aliased modules.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Svelte error boundary (with SSR support) • REPL • Svelte
The code inside this boundary will throw immediately --> ... <dd><a href="https://www.npmjs.com/package/@crownframework/svelte-error-boundary">https://www.
Read more >cannot read property 'insert' of undefined npm install - You.com
Trying to install express or any other package with npm brings forth this error "npm ERR! Cannot read property 'insert' of undefined". Ubuntu...
Read more >Unable to verify leaf signature - Stack Overflow
First install ssl-root-cas package from npm: npm install ssl-root-cas ... I still ended up with the UNABLE_TO_VERIFY_LEAF_SIGNATURE error.
Read more >Changelog | Meteor API Docs
Throwing an error when the login tokens are not generated well calling requestLoginTokenForUser. PR. Node updated to v14.19.3; npm update to v6.14.17; Fix ......
Read more >Integrate Auth0 with Angular SSR
After implementing SSR, I got the error “For security reasons, ... we need some npm package compatible with Angular SSR (Angular Universal).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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,
Ah looks like that’s it. I didn’t notice the
pkg.sveltewas added before publishing. This would be a bug invite-plugin-sveltethen, moving it over.