question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build fails when passing manualchunks to rollup

See original GitHub issue

Describe 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:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
benmccanncommented, Jul 28, 2021

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 of inlineDynamicImports that doesn’t allow it to work

2reactions
bhvngtcommented, Jul 24, 2021

Hi @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

		vite: {
			build: {
				chunkSizeWarningLimit: 1024,
				rollupOptions: {
					output: {
						inlineDynamicImports: false,
						manualChunks: {
							'framework7-core': ['framework7/lite'],
							'framework7-svelte': ['framework7-svelte']
						}
					}
				},
			}
		}
 build_server: The value for kit.vite.build.rollupOptions.output.inlineDynamicImports specified in svelte.config.js has been ignored. This option is controlled by SvelteKit.
vite v2.4.3 building SSR bundle for production...
✓ 237 modules transformed.
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 (node_modules/.pnpm/rollup@2.52.8/node_modules/rollup/dist/shared/rollup.js:164:30)
    at getManualChunks (node_modules/.pnpm/rollup@2.52.8/node_modules/rollup/dist/shared/rollup.js:20841:20)
    at normalizeOutputOptions (node_modules/.pnpm/rollup@2.52.8/node_modules/rollup/dist/shared/rollup.js:20612:23)
    at getOutputOptions (node_modules/.pnpm/rollup@2.52.8/node_modules/rollup/dist/shared/rollup.js:20963:12)
    at getOutputOptionsAndPluginDriver (node_modules/.pnpm/rollup@2.52.8/node_modules/rollup/dist/shared/rollup.js:20958:12)
    at handleGenerateWrite (node_modules/.pnpm/rollup@2.52.8/node_modules/rollup/dist/shared/rollup.js:20935:74)
    at Object.write (node_modules/.pnpm/rollup@2.52.8/node_modules/rollup/dist/shared/rollup.js:20902:20)
    at generate (node_modules/.pnpm/vite@2.4.3/node_modules/vite/dist/node/chunks/dep-f2b4ca46.js:51620:64)
    at doBuild (node_modules/.pnpm/vite@2.4.3/node_modules/vite/dist/node/chunks/dep-f2b4ca46.js:51633:26)
    at async Object.build (node_modules/.pnpm/vite@2.4.3/node_modules/vite/dist/node/chunks/dep-f2b4ca46.js:51457:16)
Read more comments on GitHub >

github_iconTop Results From Across the Web

rollup.js
Exit the build with an error if any warnings occurred, once the build is complete. --environment <values>. Pass additional settings to the config...
Read more >
How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
This week, we're going to build our first project using Rollup, which is a build tool for bundling JavaScript (and stylesheets, but we'll...
Read more >
Rollup throws an error with the argument flag when using a ...
Rollup successfully passes the argument into the config file. But it throws a warning in the command line: (!) You have passed an...
Read more >
Build Options - Vite
Note the build will fail if the code contains features that cannot be safely transpiled by ... Options to pass on to @rollup/plugin-dynamic-import-vars....
Read more >
rollup-plugin-styles
import { css } from "./style.css";. In emit mode none of the exports are available as CSS is purely processed and passed along...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found