question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken legacy build

See original GitHub issue

Describe the bug

Building with plugin-legacy seems to be broken

Reproduction

  1. create new project with yarn create @vitejs/app (template - react + ts)
  2. add @vitejs/plugin-legacy - yarn add -D @vitejs/plugin-legacy
  3. update vite.config.ts -
import { defineConfig } from 'vite';
import legacy from '@vitejs/plugin-legacy';
import reactRefresh from '@vitejs/plugin-react-refresh';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [legacy(), reactRefresh()],
});
  1. run yarn build // error

System Info

  • vite version: 2.0.5
  • Operating System: Windows 10
  • Node version: 14.15.5
  • Package manager (npm/yarn/pnpm) and version: yarn@1.22.10

Logs (Optional if provided reproduction)

  1. Run vite build with the --debug flag.
$ tsc && vite build --debug
  vite:config bundled config file loaded in 201ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'alias',
  vite:config     'react-refresh',
  vite:config     'vite:dynamic-import-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'legacy-generate-polyfill-chunk',
  vite:config     'legacy-env',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'legacy-post-process',
  vite:config     'vite:import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:reporter'
  vite:config   ],
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge16', 'firefox60', 'chrome61', 'safari11' ],
  vite:config     polyfillDynamicImport: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     sourcemap: false,
  vite:config     rollupOptions: { output: [Array] },
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     minify: 'terser',
  vite:config     terserOptions: {},
  vite:config     cleanCssOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     brotliSize: true,
  vite:config     chunkSizeWarningLimit: 500
  vite:config   },
  vite:config   define: { 'import.meta.env.LEGACY': '__VITE_IS_LEGACY__' },
  vite:config   configFile: 'C:/Users/azymov/Documents/projects/vite-project/vite.config.ts',
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     build: {}
  vite:config   },
  vite:config   root: 'C:/Users/azymov/Documents/projects/vite-project',
  vite:config   base: '/',
  vite:config   resolve: { dedupe: undefined, alias: [ [Object] ] },
  vite:config   publicDir: 'C:\\Users\\azymov\\Documents\\projects\\vite-project\\public',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   optimizeCacheDir: 'C:\\Users\\azymov\\Documents\\projects\\vite-project\\node_modules\\.vite',
  vite:config   server: {},
  vite:config   env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen]
  vite:config   },
  vite:config   createResolver: [Function: createResolver]
  vite:config } +5ms
vite v2.0.5 building for production...
✓ 21 modules transformed.
[legacy-post-process] [BABEL] unknown: .plugins[36][0] must be a string, object, function
error during build:
Error: [BABEL] unknown: .plugins[36][0] must be a string, object, function
    at assertPluginTarget (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67416:12)
    at assertPluginItem (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67390:6)
    at C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67373:15
    at Array.forEach (<anonymous>)
    at assertPluginList (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67372:10)
    at C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67591:6
    at Array.forEach (<anonymous>)
    at validateNested (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67567:22)
    at validate$3 (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67558:11)
    at C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:69754:15
  1. Provide the error log here.
$ tsc && vite build
vite v2.0.5 building for production...
✓ 21 modules transformed.
[legacy-post-process] [BABEL] unknown: .plugins[36][0] must be a string, object, function
error during build:
Error: [BABEL] unknown: .plugins[36][0] must be a string, object, function
    at assertPluginTarget (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67416:12)
    at assertPluginItem (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67390:6)   
    at C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67373:15
    at Array.forEach (<anonymous>)
    at assertPluginList (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67372:10)  
    at C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67591:6
    at Array.forEach (<anonymous>)
    at validateNested (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67567:22)    
    at validate$3 (C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:67558:11)
    at C:\Users\azymov\Documents\projects\vite-project\node_modules\@babel\standalone\babel.js:69754:15

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pedrodimcommented, Mar 11, 2021

@Eazymov since you’re using yarn, as a temporal workaround similar to the one on #2442, you can try and use selective resolution to pin the version. https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-how-to-use-it

0reactions
patak-devcommented, Mar 12, 2021

Closing as duplicate of #2442

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon.com: Broken Legacy (Dark Legacy Book 3) eBook
Dark Legacy (dark and sexy contemp romance): Broken Wings. Broken Trust. Broken Legacy. Dylan. Secret Keepers (upper YA paranormal romance): House of Darken....
Read more >
I'd like to make a character on standard soley for the ... - Reddit
The most broken standard exclusive build currently is Soulcatcher flask effect to reduce vaal skill cost to 0 in combination with 2 legacy...
Read more >
Broken Legacy - Jaymin Eve - Goodreads
The last book in this story but not the last in the Dark Legacy world! The build up through all 3 books was...
Read more >
Broken Legacy | Spotify
These cookies may be used to deliver targeted advertisements and to build a profile of your interests. If you do not allow these...
Read more >
Broken Legacy - SoundCloud
Play Broken Legacy on SoundCloud and discover followers on SoundCloud | Stream tracks, albums, playlists on desktop and mobile.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found