Closed
Description
Describe the bug
When trying to build application with enableNativePlugin: true
, dynamic import references are incorrectly renamed/referenced. Everything looks OK when using enableNativePlugin: 'resolver'
.
With enableNativePlugin: true
async function main() {
const { default: default$1 } = await __vitePreload(async () => {
const { default: default$2 } = await import("./foo.js");
return { default: default$2 };
}, []);
foo(); // ❌
}
main();
With enableNativePlugin: 'resolver'
async function main() {
const { default: foo } = await __vitePreload(async () => {
const { default: foo$1 } = await import("./foo.js");
return { default: foo$1 };
}, []);
foo(); // ✅
}
main();
Reproduction
https://stackblitz.com/edit/vitejs-rolldown-vite-43t3ie67?file=vite.config.js
Steps to reproduce
- Run
npm run build
- Observe
dist/main.js
output
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
rolldown-vite: 6.3.18
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs and the Rolldown-related guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.