Build fails when passing manualchunks to rollup
See original GitHub issueDescribe the bug When passing manual chunks to rollup through vite, the build falls.
Logs n/a see stack trace
To Reproduce
To recreate, I added:
vite: {
build: {
rollupOptions: {
output: {
manualChunks: {
lodash: ['lodash']
}
}
}
}
}
to svelte.config.js
in the hacker news example and I get the following error.
The "output.manualChunks" option is not supported for "output.inlineDynamicImports".
> The "output.manualChunks" option is not supported for "output.inlineDynamicImports".
Error: The "output.manualChunks" option is not supported for "output.inlineDynamicImports".
Note, I get the same error with different manualChunk
configs. I also got an error in my project after installing the local build. I tried disabling inlineDynamicImports
but that config is protected by sveltekit.
Expected behavior
The build should succeed. I suppose there should be a way to specify “output.inlineDynamicImports
.” If sveltekit is manually edited to disable inlineDynamicImports
the build will pass:
I hacked my @sveltejs/kit locally to comment out // inlineDynamicImports: true and everything works as expected with a lodash chunk on the Sveltekit demo app
from comment by @johnnysprinkles
Stacktraces
Stack trace
The "output.manualChunks" option is not supported for "output.inlineDynamicImports".
> The "output.manualChunks" option is not supported for "output.inlineDynamicImports".
Error: The "output.manualChunks" option is not supported for "output.inlineDynamicImports".
at error (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:164:30)
at getManualChunks (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:20695:20)
at normalizeOutputOptions (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:20466:23)
at getOutputOptions (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:20817:12)
at getOutputOptionsAndPluginDriver (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:20812:12)
at handleGenerateWrite (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:20789:74)
at Object.write (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:20756:20)
at generate (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/dist/node/chunks/dep-bc228bbb.js:45393:64)
at doBuild (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/dist/node/chunks/dep-bc228bbb.js:45406:26)
at async Object.build (/home/paul/external/kit/node_modules/.pnpm/vite@2.3.7/node_modules/vite/dist/node/chunks/dep-bc228bbb.js:45230:16)
Information about your SvelteKit Installation:
Diagnostics
I am running a locally built version of the master branch so version 1.116(?) of sveltekit
$ npx envinfo --system --npmPackages svelte,@sveltejs/kit,@sveltejs/adapter-node,@sveltejs/adapter-static,@sveltejs/adapter-begin,@sveltejs/adapter-netlify,@sveltejs/adapter-vercel vite --binaries --browsers
npx: installed 1 in 0.977s
System:
OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 3.64 GB / 15.52 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.17.0 - ~/.asdf/installs/nodejs/14.17.0/bin/node
npm: 6.14.13 - ~/.asdf/installs/nodejs/14.17.0/bin/npm
Browsers:
Firefox: 89.0.1
npmPackages:
@sveltejs/adapter-node: ^1.0.0-next.25 => 1.0.0-next.25
@sveltejs/adapter-static: ^1.0.0-next.11 => 1.0.0-next.11
@sveltejs/kit: ^1.0.0-next.115 => 1.0.0-next.115
svelte: ^3.38.0 => 3.38.2
Severity Low, I was just trying to change my build output by reshaping the vendor chunk. I am able to deploy without this change.
Additional context related to:
- https://github.com/sveltejs/kit/issues/1571 (related issue with some triage comments for this issue at the bottom)
- https://github.com/sveltejs/kit/pull/1572 (pr which added the ability to specify
manualChunks
)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
In the description to https://github.com/sveltejs/kit/pull/1572, @johnnysprinkles said “it allows us to specify
manualChunks
”, so I expected it to work now. And yes, that change has been released. But it looks like I missed that SvelteKit forces a value ofinlineDynamicImports
that doesn’t allow it to workHi @benmccann. Is the fix #1572 rolled out? I am using sveltejs/kit
1.0.0-next.136
and I am still facing this issue. Here’s my vite config followed by the error log