vite-ssg
vite-ssg copied to clipboard
using build.rollupOptions.output.manualChunks
Describe the bug
How can I use manualChunks?
vite.config.ts
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
lottie: ['vue3-lottie']
}
}
}
},
})
logs
ERROR 11:23:55
[vite-ssg] An internal error occurred.
ERROR [vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues 11:23:55
/node_modules/rollup/dist/es/shared/parseAst.js:337
base = Object.assign(new Error(base.message), base);
^
Error [RollupError]: "vue3-lottie" cannot be included in manualChunks because it is resolved as an external module by the "external" option or plugins.
at error (/node_modules/rollup/dist/es/shared/parseAst.js:337:30)
at ModuleLoader.loadEntryModule (/node_modules/rollup/dist/es/shared/node-entry.js:18049:20)
at async Promise.all (index 0)
at async Promise.all (index 0) {
code: 'EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS'
}
Reproduction
System Info
System:
OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
Memory: 21.60 GB / 31.28 GB
Container: Yes
Shell: 5.2.15 - /bin/bash
Binaries:
Node: 18.20.0 - ~/n/bin/node
Yarn: 1.22.21 - ~/n/bin/yarn
npm: 10.5.0 - ~/n/bin/npm
Browsers:
Chrome: 123.0.6312.86
Used Package Manager
yarn
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.