Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite 2.6.x + @vitejs/plugin-legacy broken behavior with esbuild minify default #5157

Closed
7 tasks done
tjk opened this issue Sep 30, 2021 · 0 comments · Fixed by #5168
Closed
7 tasks done

vite 2.6.x + @vitejs/plugin-legacy broken behavior with esbuild minify default #5157

tjk opened this issue Sep 30, 2021 · 0 comments · Fixed by #5168

Comments

@tjk
Copy link
Contributor

tjk commented Sep 30, 2021

Describe the bug

Please see repro -- should be well explained there. It looks like the legacy polyfill chunks use terser for minification in all cases (https://github.com/vitejs/vite/blob/main/packages/plugin-legacy/index.js#L542) but I'm not sure if it still requires rest of files to NOT use esbuild? (bails in configResolved: https://github.com/vitejs/vite/blob/main/packages/plugin-legacy/index.js#L101)

Hopefully can still benefit from esbuild minification, but if not -- should update documentation and perhaps label a breaking change somewhere?

Reproduction

https://github.com/tjk/vite-plugin-legacy-esbuild-issue

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900KF @ 3.50GHz
    Memory: 1.94 GB / 12.38 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.17.0 - ~/.asdf/installs/nodejs/14.17.0/bin/node
    npm: 6.14.13 - ~/.asdf/installs/nodejs/14.17.0/bin/npm
  npmPackages:
    @vitejs/plugin-vue: latest => 1.9.2
    vite: latest => 2.6.2

Used Package Manager

pnpm

Logs

error during build:
Error: Can't use esbuild as the minifier when targeting legacy browsers because esbuild minification is not legacy safe.
    at Object.configResolved (/home/tjk/src/github.com/tjk/vite-plugin-legacy-esbuild-issue/node_modules/.pnpm/@vitejs+plugin-legacy@1.6.0_vite@2.6.2/node_modules/@vitejs/plugin-legacy/index.js:101:15)
    at /home/tjk/src/github.com/tjk/vite-plugin-legacy-esbuild-issue/node_modules/.pnpm/vite@2.6.2_fa61c471ed365d086e71b610b15aabb9/node_modules/vite/dist/node/chunks/dep-24231913.js:76446:127
    at Array.map (<anonymous>)
    at resolveConfig (/home/tjk/src/github.com/tjk/vite-plugin-legacy-esbuild-issue/node_modules/.pnpm/vite@2.6.2_fa61c471ed365d086e71b610b15aabb9/node_modules/vite/dist/node/chunks/dep-24231913.js:76446:35)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async doBuild (/home/tjk/src/github.com/tjk/vite-plugin-legacy-esbuild-issue/node_modules/.pnpm/vite@2.6.2_fa61c471ed365d086e71b610b15aabb9/node_modules/vite/dist/node/chunks/dep-24231913.js:51168:20)
    at async build (/home/tjk/src/github.com/tjk/vite-plugin-legacy-esbuild-issue/node_modules/.pnpm/vite@2.6.2_fa61c471ed365d086e71b610b15aabb9/node_modules/vite/dist/node/chunks/dep-24231913.js:51156:16)
    at async CAC.<anonymous> (/home/tjk/src/github.com/tjk/vite-plugin-legacy-esbuild-issue/node_modules/.pnpm/vite@2.6.2_fa61c471ed365d086e71b610b15aabb9/node_modules/vite/dist/node/cli.js:740:9)

Validations

haoqunjiang added a commit to haoqunjiang/vite that referenced this issue Oct 1, 2021
haoqunjiang added a commit to haoqunjiang/vite that referenced this issue Oct 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant