-
-
Notifications
You must be signed in to change notification settings - Fork 8k
vite 2.6.x + @vitejs/plugin-legacy broken behavior with esbuild minify default #5157
Copy link
Copy link
Closed
Labels
Description
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
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.2Used 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/@[email protected][email protected]/node_modules/@vitejs/plugin-legacy/index.js:101:15)
at /home/tjk/src/github.com/tjk/vite-plugin-legacy-esbuild-issue/node_modules/.pnpm/[email protected]_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/[email protected]_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/[email protected]_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/[email protected]_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/[email protected]_fa61c471ed365d086e71b610b15aabb9/node_modules/vite/dist/node/cli.js:740:9)Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- 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 https://github.com/vuejs/vue-next instead.
- 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.
Reactions are currently unavailable