vite
vite copied to clipboard
When using @rollup/plugin-babel, there might be issues with the generated code order
Describe the bug
The declaration and usage order of variables is incorrect in the generated code when using the above configuration for polyfill during bundling.
Reproduction
https://stackblitz.com/edit/vitejs-vite-lpqcmx?file=dist%2Fvite-starter.iife.js
Steps to reproduce
-
pnpm i
-
pnpm build
- view dist/vite-starter.iife.js
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: 18.18.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
pnpm: 8.10.5 - /usr/local/bin/pnpm
npmPackages:
vite: ^5.0.8 => 5.0.10
Used Package Manager
pnpm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
If I move the configuration options to the Vite plugins, it works correctly, but it doesn't handle polyfill in .vue files.