Legacy build fails on babel step
See original GitHub issueDescribe the bug
The build with the legacy plugin active fails with an error from babel.
❯ npm run build
> vite-project@0.0.0 build
> tsc && vite build
vite v2.0.5 building for production...
✓ 21 modules transformed.
[legacy-post-process] [BABEL] unknown: .plugins[13][0] must be a string, object, function
error during build:
Error: [BABEL] unknown: .plugins[13][0] must be a string, object, function
at assertPluginTarget (/Sites/vite-project/node_modules/@babel/standalone/babel.js:67416:12)
at assertPluginItem (//Sites/vite-project/node_modules/@babel/standalone/babel.js:67390:6)
at //Sites/vite-project/node_modules/@babel/standalone/babel.js:67373:15
at Array.forEach (<anonymous>)
at assertPluginList (/Sites/vite-project/node_modules/@babel/standalone/babel.js:67372:10)
at /Sites/vite-project/node_modules/@babel/standalone/babel.js:67591:6
at Array.forEach (<anonymous>)
at validateNested (/Sites/vite-project/node_modules/@babel/standalone/babel.js:67567:22)
at validate$3 (/Sites/vite-project/node_modules/@babel/standalone/babel.js:67558:11)
at /Sites/vite-project/node_modules/@babel/standalone/babel.js:69754:15
Reproduction
Base config
import { defineConfig } from 'vite'
import legacy from '@vitejs/plugin-legacy'
export default defineConfig({
plugins: [legacy({ targets: ['defaults', 'not IE 11'] })]
})
System Info
vite
version: 2.0.5- Operating System: macOS Big Sur
- Node version: 12.21.0
- Package manager (npm/yarn/pnpm) and version: npm 7.6.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Webpack build failing with ERR_OSSL_EVP_UNSUPPORTED
I was able to fix it via: export NODE_OPTIONS=--openssl-legacy-provider. sachaw's comment to Node.js v17.0.0 - Error starting project in ...
Read more >[Docker Course 4-13] Issue on npm install step
Hello there, I've facing an issue while installing the app dependencies, returning an user permission denied while accessing the /app ...
Read more >Build Setup Recipes
The main strategy people adopt is having 2 builds: Modern JS build - transpile Svelte as is; Legacy browser build - add Babel...
Read more >babel/polyfill
Babel includes a polyfill that includes a custom regenerator runtime and core-js. This will emulate a full ES2015+ environment (no < Stage 4...
Read more >Troubleshooting | Stryker Mutator
Mutating fails: Cannot use the decorators and decorators-legacy plugin together. Example: ERROR Stryker Unexpected error occurred while running Stryker Error: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a temporary workaround you can pin the
@babel/standalone
version to7.13.9
inpackage.json
:@mengelbrecht Where exactly are we supposed to pin@babel/standalone
? Since it looks likeplugin-legacy
vendors it’s own version of@babel/standalone
at^7.12.12
.For those using
yarn
for their package manager, I got this working with