-
Notifications
You must be signed in to change notification settings - Fork 700
Description
Reproduction link or steps
-
Clone the repository:
git clone https://github.com/maxpatiiuk/rolldown-generate-bundle cd rolldown-generate-bundle -
Install rolldown and rollup dependencies:
npm install
-
Build
npx rolldown -c npx rollup -c
-
See that
dist-rollup/containsindex-renamed.js(expected). See thatdist-rolldown/containsindex.js(unexpected).
What is expected?
Changes to the chunk file name during generateBundle stage should be reflected.
What is actually happening?
Changes to the chunk file name during generateBundle stage are ignored.
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Pro
Memory: 112.75 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.16.0 - ~/.local/state/fnm_multishells/2948_1753488629234/bin/node
Yarn: 1.22.19 - ~/.local/state/fnm_multishells/2948_1753488629234/bin/yarn
npm: 10.9.2 - ~/.local/state/fnm_multishells/2948_1753488629234/bin/npm
pnpm: 8.9.0 - ~/.local/state/fnm_multishells/2948_1753488629234/bin/pnpm
Browsers:
Chrome: 138.0.7204.169
Safari: 18.5
npmPackages:
rolldown: ^1.0.0-beta.29 => 1.0.0-beta.29Any additional comments?
TLDR:
Discovered while testing compatibility of my framework with rolldown-vite.
I don't yet know the chunk file name at theconfig()stage - I know it by thegenerateBundle()stage, so I rename the chunks duringgenerateBundle().
I am a web component framework author. The frameworks creates an entrypoint for each web component based on the web component tag name. The tag name is written inside the component source code.
During the config() stage I run readdir() to find the list of web component entrypoint files and pass such list to lib.entries in Vite (which is then passed to Rollup/Rolldown as input).
During transform stage, I collect information about each web component, including the tag name.
Later, during the generateBundle stage, I rename each chunk (and its references) to use the web component tag name instead of the original source code file name.
If this is not possible in Rolldown, I would either need to rename the files after Rolldown prints them to disk (tricky as that may conflict with other plugins) or reachitect the framework to parse each file and extract the tag name during the config() stage.