[pnpm 6] `pnpm build`: failed to resolve import `@sveltejs/kit/ssr`
See original GitHub issueDescribe the bug
When using pnpm build
on pnpm 6.0.0 on a new kit project, it fails because @sveltejs/kit/ssr
is not properly found during the build step bundling. This issue does not occur on npm
or yarn
. Dev mode works.
To Reproduce
npm init svelte@next
pnpm i
pnpm build
Expected behavior Build successful.
Stacktraces
Stack trace
$ pnpm build
> kit-71c@0.0.1 build C:\Users\GrygrFlzr\Documents\projects\kit-71c
> svelte-kit build
vite v2.1.5 building for production...
✓ 18 modules transformed.
.svelte/output/client/_app/manifest.json 0.67kb
.svelte/output/client/_app/assets/start-d4cd1237.css 0.29kb / brotli: 0.18kb
.svelte/output/client/_app/assets/pages\index.svelte-98e7943e.css 0.69kb / brotli: 0.26kb
.svelte/output/client/_app/pages\index.svelte-dd1966a7.js 1.58kb / brotli: 0.68kb
.svelte/output/client/_app/chunks/vendor-b2527fc7.js 5.14kb / brotli: 2.00kb
.svelte/output/client/_app/start-bd465435.js 15.41kb / brotli: 5.25kb
vite v2.1.5 building SSR bundle for production...
✓ 1 modules transformed.
[vite]: Rollup failed to resolve import "@sveltejs/kit/ssr" from ".svelte\build\app.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
> [vite]: Rollup failed to resolve import "@sveltejs/kit/ssr" from ".svelte\build\app.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
Error: [vite]: Rollup failed to resolve import "@sveltejs/kit/ssr" from ".svelte\build\app.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
at onRollupWarning (C:\Users\GrygrFlzr\Documents\projects\kit-71c\node_modules\.pnpm\vite@2.1.5\node_modules\vite\dist\node\chunks\dep-66eb515d.js:44389:19)
at Object.onwarn (C:\Users\GrygrFlzr\Documents\projects\kit-71c\node_modules\.pnpm\vite@2.1.5\node_modules\vite\dist\node\chunks\dep-66eb515d.js:44239:17)
at Object.onwarn (C:\Users\GrygrFlzr\Documents\projects\kit-71c\node_modules\.pnpm\rollup@2.44.0\node_modules\rollup\dist\shared\rollup.js:19784:20)
at ModuleLoader.handleResolveId (C:\Users\GrygrFlzr\Documents\projects\kit-71c\node_modules\.pnpm\rollup@2.44.0\node_modules\rollup\dist\shared\rollup.js:18526:26)
at C:\Users\GrygrFlzr\Documents\projects\kit-71c\node_modules\.pnpm\rollup@2.44.0\node_modules\rollup\dist\shared\rollup.js:18480:22
at async Promise.all (index 0)
at async ModuleLoader.fetchStaticDependencies (C:\Users\GrygrFlzr\Documents\projects\kit-71c\node_modules\.pnpm\rollup@2.44.0\node_modules\rollup\dist\shared\rollup.js:18478:34)
at async Promise.all (index 0)
at async ModuleLoader.fetchModule (C:\Users\GrygrFlzr\Documents\projects\kit-71c\node_modules\.pnpm\rollup@2.44.0\node_modules\rollup\dist\shared\rollup.js:18454:9)
at async Promise.all (index 0)
ERROR Command failed with exit code 1.
Information about your SvelteKit Installation:
System:
OS: Windows 10 10.0.19042
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 18.58 GB / 31.95 GB
Binaries:
Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.7.5 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 89.0.4389.114
Edge: Spartan (44.19041.423.0), Chromium (89.0.774.68)
Internet Explorer: 11.0.19041.1
npmPackages:
@sveltejs/kit: next => 1.0.0-next.71
svelte: ^3.37.0 => 3.37.0
vite: ^2.1.5 => 2.1.5
Severity
Easy to work around by temporarily using npm
or yarn
, but it does prevent usage of pnpm
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Error Codes | pnpm
A project has a workspace dependency that does not exist in the workspace. However, there is only bar@2.0.0 in the workspace, so pnpm...
Read more >I cannot build my sveltekit project with any adapter! failed to ...
I found the issue, it seems that pnpm 6.0.0 is causing the issue, ... [vite]: Rollup failed to resolve import "@sveltejs/kit/ssr" from ...
Read more >storybook/builder-vite is broken when using pnpm
[vite]: Rollup failed to resolve import "@storybook/preview-web" from "../../../../../../virtual:/@storybook/builder-vite/vite-app.js". I tried ...
Read more >pnpm - npm
Fast, disk space efficient package manager. Latest version: 7.21.0, last published: 7 hours ago. Start using pnpm in your project by running `npm...
Read more >Setup a Monorepo with PNPM workspaces and speed it up ...
If you now run the Remix app again you should see the button being rendered. ❯ pnpm --filter my-remix-app dev. If you happen...
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 FreeTop 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
Top GitHub Comments
6.0.1 includes https://github.com/pnpm/pnpm/pull/3314 which in the changelog specifically mentions fixing behavior in webpack and Vite, so I’m going to close this.
Well that was fast -
pnpm@latest
is as of this writingpnpm@6.0.1
, and I’m no longer able to reproduce this with that version.