I have a module with a good handful of chunks A
, B
, C
, and D
, all of which rely on a shared utilities file which Rollup separately chunks.
Because this utilities file is only a couple of Kb, and because every single child chunk requires it, I want to merge this utilities file back into the main entrypoint. It does absolutely no good as a chunk on it’s own.
However, I can’t figure out how to do this. Rollup documents the manualChunks(id)
option but it has absolutely no documentation on how you merge back into the entrypoint. Providing a generic name like index
creates two index.<hash>.js
files, one being the entrypoint and the second being my utilities file.
manualChunks(id) {
if (id.includes('lib/utilities.js')) {
return 'index';
}
}
How can I force Rollup to hoist this module back up into the entrypoint?