vite icon indicating copy to clipboard operation
vite copied to clipboard

When using @rollup/plugin-babel, there might be issues with the generated code order

Open Lpmvb opened this issue 1 year ago • 2 comments

Describe the bug

image The declaration and usage order of variables is incorrect in the generated code when using the above configuration for polyfill during bundling. image

image

Reproduction

https://stackblitz.com/edit/vitejs-vite-lpqcmx?file=dist%2Fvite-starter.iife.js

Steps to reproduce

  1. pnpm i
  2. pnpm build
  3. 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

Lpmvb avatar Dec 25 '23 09:12 Lpmvb

If I move the configuration options to the Vite plugins, it works correctly, but it doesn't handle polyfill in .vue files.

Lpmvb avatar Dec 25 '23 09:12 Lpmvb