rolldown: Windows duplicate importz
When building a project with rolldown using an absolute path import on Windows, the resulting bundle (output.js) contains duplicated modules. Specifically, modules like react.production.js appear twice under different paths, causing inflated bundles and potential runtime issues. This issue does not occur on Linux.
-
Clone the reproduction repo on a Windows machine: https://github.com/avivkeller/rolldown-repro-5364
-
Modify the import in
entrypoint.jsxto use an absolute path toimported.jsx, e.g.:import Imported from "/absolute/path/to/imported"; -
Run:
npm install node repro.mjs
The generated output.js file contains duplicated entries for dependencies such as react, with region comments showing both of the following:
//#region \absolute\path\to\node_modules\react\cjs\react.production.js
//#region node_modules/react/cjs/react.production.js
The bundle should deduplicate modules regardless of how they’re imported. Only one instance of react.production.js (and similar) should appear in the output.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 22 (11 by maintainers)
esbuildappears to support this format (though it may have issues), butRollupdoes not. For now, we align our behavior withRollup.I’m starting to understand it better now — with this information, I can reproduce the issue too. However, I don’t think treating a path like
D:\\my\\pathas/my/pathon Windows is the correct behavior, but it works. Let me discuss this usage with the rolldown team.Sorry again for initially being confusing, I know how annoying it is to receive vague bug reports with massive code bases.
Okay, I understand. I will recheck it.
@shulaoda Could you check this out?