Skip to content

Errors when multiple versions of same browser is specified in build.target #140

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

Open
6 tasks done
nstepien opened this issue Apr 24, 2025 · 8 comments
Open
6 tasks done
Labels
bug: upstream Bug in a dependency of Vite

Comments

@nstepien
Copy link

Describe the bug

It seems like this is enough to crash rolldown-vite when running vite build:

export default defineConfig({
  build: {
    target: ['chrome135', 'chrome134'],
    // or
    // target: ['edge135', 'edge134'],
  }
})
> vite build

You have set `optimizeDeps.esbuildOptions` but this options is now deprecated. Vite now uses Rolldown to optimize the dependencies. Please use `optimizeDeps.rollupOptions` instead.

♻️  Generating routes...
✅ Processed routes in 77ms
vite v6.3.5 building for production...
transforming (9) node_modules\react\cjs\react-jsx-runtime.production.jstarget was modified to include ES2021 because useDefineForClassFields is set to false and oxc does not support transforming useDefineForClassFields=false for ES2022+ yet
✓ 569 modules transformed.
✗ Build failed in 1.61s
error during build:
Build failed with 1 error:

[plugin vite:oxc-transpile]
Error: 'chrome134' is already specified.
    at transformWithOxc (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:10130:19)
    at PluginContextImpl.renderChunk (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:10254:25)
    at PluginContextImpl.handler (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:44535:15)
    at plugin (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:1829:30)
    at plugin.<computed> (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:2171:18)
    at normalizeErrors (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:935:18) 
    at handleOutputErrors (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:1758:34)
    at transformToRollupOutput (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:1752:2)
    at RolldownBuild.write (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:4168:11)
    at async buildEnvironment (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:44210:16)
    at async Object.defaultBuildApp [as buildApp] (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:44714:5)
    at async CAC.<anonymous> (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/cli.js:863:7)

This does not happen with vite serve or vitest.

Reproduction

adazzle/react-data-grid#3771

Steps to reproduce

Configure a target with the last to version of modern browsers, then run vite build.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (32) x64 AMD Ryzen 9 9950X3D 16-Core Processor
    Memory: 41.97 GB / 63.58 GB
  Binaries:
    Node: 23.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.99)
  npmPackages:
    @vitejs/plugin-react: ^4.4.1 => 4.4.1
    rolldown: ^1.0.0-beta.8 => 1.0.0-beta.8-commit.2686eb1
    rolldown-vite:  6.3.5

Used Package Manager

npm

Logs

Click to expand!
  vite:config config file loaded in 200.36ms +0ms
You have set `optimizeDeps.esbuildOptions` but this options is now deprecated. Vite now uses Rolldown to optimize the dependencies. Please use `optimizeDeps.rollupOptions` instead.
  vite:env loading env files: [
  vite:env   'D:/repos/react-data-grid/.env',
  vite:env   'D:/repos/react-data-grid/.env.local',
  vite:env   'D:/repos/react-data-grid/.env.production',
  vite:env   'D:/repos/react-data-grid/.env.production.local'
  vite:env ] +0ms
  vite:env env files loaded in 0.35ms +0ms
  vite:env using resolved env: {} +0ms

♻️  Generating routes...
✅ Processed routes in 81ms
  vite:config using resolved config: {
  vite:config   base: '/react-data-grid/',
  vite:config   cacheDir: 'D:/repos/react-data-grid/.cache/vite',
  vite:config   clearScreen: false,
  vite:config   build: {
  vite:config     target: [ 'edge135', 'edge134' ],
  vite:config     polyfillModulePreload: true,
  vite:config     modulePreload: { polyfill: false },
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     sourcemap: true,
  vite:config     terserOptions: {},
  vite:config     rollupOptions: { platform: 'browser', onwarn: [Function: onwarn] },
  vite:config     commonjsOptions: { include: [ /node_modules/ ], extensions: [ '.js', '.cjs' ] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [ /node_modules/ ] },
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     copyPublicDir: true,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssrManifest: false,
  vite:config     ssrEmitAssets: false,
  vite:config     reportCompressedSize: false,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null,
  vite:config     cssCodeSplit: true,
  vite:config     minify: 'oxc',
  vite:config     ssr: false,
  vite:config     emitAssets: true,
  vite:config     createEnvironment: [Function: createEnvironment],
  vite:config     cssTarget: [ 'edge135', 'edge134' ],
  vite:config     cssMinify: true
  vite:config   },
  vite:config   plugins: [
  vite:config     'vite:watch-package-data',
  vite:config     'alias',
  vite:config     'router-code-splitter-plugin',
  vite:config     'vite:react-babel',
  vite:config     'vite:react-refresh',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-proxy',
  vite:config     'vite:css',
  vite:config     'vite:oxc',
  vite:config     'vite:json',
  vite:config     'vite:wasm-helper',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'router-generator-plugin',
  vite:config     'vite:wasm-fallback',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:asset-import-meta-url',
  vite:config     'vite:force-systemjs-wrap-complete',
  vite:config     'vite:rollup-options-plugins',
  vite:config     'vite:dynamic-import-vars',
  vite:config     'vite:import-glob',
  vite:config     'wyw-in-js',
  vite:config     'vite:build-import-analysis',
  vite:config     'vite:oxc-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:manifest',
  vite:config     'vite:ssr-manifest',
  vite:config     'vite:reporter',
  vite:config     'vite:load-fallback'
  vite:config   ],
  vite:config   server: {
  vite:config     port: 5173,
  vite:config     strictPort: false,
  vite:config     host: undefined,
  vite:config     allowedHosts: [],
  vite:config     https: undefined,
  vite:config     open: true,
  vite:config     proxy: undefined,
  vite:config     cors: {
  vite:config       origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/
  vite:config     },
  vite:config     headers: {},
  vite:config     warmup: { clientFiles: [], ssrFiles: [] },
  vite:config     middlewareMode: false,
  vite:config     fs: {
  vite:config       strict: true,
  vite:config       deny: [ '.env', '.env.*', '*.{crt,pem}', '**/.git/**' ],
  vite:config       allow: [ 'D:/repos/react-data-grid' ]
  vite:config     },
  vite:config     preTransformRequests: true,
  vite:config     perEnvironmentStartEndDuringDev: false,
  vite:config     sourcemapIgnoreList: [Function: isInNodeModules$1]
  vite:config   },
  vite:config   test: {
  vite:config     globals: true,
  vite:config     coverage: {
  vite:config       provider: 'v8',
  vite:config       enabled: false,
  vite:config       include: [ 'src/**/*.{ts,tsx}' ],
  vite:config       reporter: [ 'json' ]
  vite:config     },
  vite:config     testTimeout: 5000,
  vite:config     restoreMocks: true,
  vite:config     sequence: { shuffle: true },
  vite:config     workspace: [
  vite:config       {
  vite:config         extends: true,
  vite:config         test: {
  vite:config           name: 'browser',
  vite:config           include: [ 'test/browser/**/*.test.*' ],
  vite:config           browser: {
  vite:config             enabled: true,
  vite:config             provider: 'playwright',
  vite:config             instances: [
  vite:config               {
  vite:config                 browser: 'chromium',
  vite:config                 context: { viewport: { width: 1920, height: 1080 } }
  vite:config               }
  vite:config             ],
  vite:config             commands: {
  vite:config               resizeColumn: [AsyncFunction: resizeColumn],
  vite:config               dragFill: [AsyncFunction: dragFill]
  vite:config             },
  vite:config             viewport: { width: 1920, height: 1080 },
  vite:config             headless: true,
  vite:config             screenshotFailures: true
  vite:config           },
  vite:config           setupFiles: [ 'test/setupBrowser.ts' ]
  vite:config         }
  vite:config       },
  vite:config       {
  vite:config         extends: true,
  vite:config         test: {
  vite:config           name: 'node',
  vite:config           include: [ 'test/node/**/*.test.*' ],
  vite:config           environment: 'node'
  vite:config         }
  vite:config       }
  vite:config     ]
  vite:config   },
  vite:config   esbuild: { jsxDev: false, jsx: 'automatic', jsxImportSource: undefined },
  vite:config   optimizeDeps: {
  vite:config     include: [
  vite:config       'react',
  vite:config       'react-dom',
  vite:config       'react/jsx-dev-runtime',
  vite:config       'react/jsx-runtime'
  vite:config     ],
  vite:config     exclude: [],
  vite:config     needsInterop: [],
  vite:config     rollupOptions: { resolve: { symlinks: true }, output: {} },
  vite:config     extensions: [],
  vite:config     disabled: undefined,
  vite:config     holdUntilCrawlEnd: true,
  vite:config     force: false,
  vite:config     noDiscovery: false,
  vite:config     esbuildOptions: { preserveSymlinks: false, jsx: 'automatic' }
  vite:config   },
  vite:config   resolve: {
  vite:config     externalConditions: [ 'node' ],
  vite:config     extensions: [
  vite:config       '.mjs',  '.js',
  vite:config       '.mts',  '.ts',
  vite:config       '.jsx',  '.tsx',
  vite:config       '.json'
  vite:config     ],
  vite:config     dedupe: [ 'react', 'react-dom' ],
  vite:config     noExternal: [],
  vite:config     external: [],
  vite:config     preserveSymlinks: false,
  vite:config     alias: [
  vite:config       {
  vite:config         find: /^\/?@vite\/env/,
  vite:config         replacement: '/@fs/D:/repos/react-data-grid/node_modules/vite/dist/client/env.mjs'
  vite:config       },
  vite:config       {
  vite:config         find: /^\/?@vite\/client/,
  vite:config         replacement: '/@fs/D:/repos/react-data-grid/node_modules/vite/dist/client/client.mjs'
  vite:config       }
  vite:config     ],
  vite:config     mainFields: [ 'browser', 'module', 'jsnext:main', 'jsnext' ],
  vite:config     conditions: [ 'module', 'browser', 'development|production' ],
  vite:config     builtins: []
  vite:config   },
  vite:config   environments: {
  vite:config     client: {
  vite:config       define: undefined,
  vite:config       resolve: {
  vite:config         externalConditions: [ 'node' ],
  vite:config         extensions: [
  vite:config           '.mjs',  '.js',
  vite:config           '.mts',  '.ts',
  vite:config           '.jsx',  '.tsx',
  vite:config           '.json'
  vite:config         ],
  vite:config         dedupe: [ 'react', 'react-dom' ],
  vite:config         noExternal: [],
  vite:config         external: [],
  vite:config         preserveSymlinks: false,
  vite:config         alias: [
  vite:config           {
  vite:config             find: /^\/?@vite\/env/,
  vite:config             replacement: '/@fs/D:/repos/react-data-grid/node_modules/vite/dist/client/env.mjs'        
  vite:config           },
  vite:config           {
  vite:config             find: /^\/?@vite\/client/,
  vite:config             replacement: '/@fs/D:/repos/react-data-grid/node_modules/vite/dist/client/client.mjs'     
  vite:config           }
  vite:config         ],
  vite:config         mainFields: [ 'browser', 'module', 'jsnext:main', 'jsnext' ],
  vite:config         conditions: [ 'module', 'browser', 'development|production' ],
  vite:config         builtins: []
  vite:config       },
  vite:config       keepProcessEnv: false,
  vite:config       consumer: 'client',
  vite:config       optimizeDeps: {
  vite:config         include: [
  vite:config           'react',
  vite:config           'react-dom',
  vite:config           'react/jsx-dev-runtime',
  vite:config           'react/jsx-runtime'
  vite:config         ],
  vite:config         exclude: [],
  vite:config         needsInterop: [],
  vite:config         rollupOptions: { resolve: { symlinks: true }, output: {} },
  vite:config         extensions: [],
  vite:config         disabled: undefined,
  vite:config         holdUntilCrawlEnd: true,
  vite:config         force: false,
  vite:config         noDiscovery: false,
  vite:config         esbuildOptions: { preserveSymlinks: false, jsx: 'automatic' }
  vite:config       },
  vite:config       dev: {
  vite:config         warmup: [],
  vite:config         sourcemap: { js: true },
  vite:config         sourcemapIgnoreList: [Function: isInNodeModules$1],
  vite:config         preTransformRequests: true,
  vite:config         createEnvironment: [Function: defaultCreateClientDevEnvironment],
  vite:config         recoverable: true,
  vite:config         moduleRunnerTransform: false
  vite:config       },
  vite:config       build: {
  vite:config         target: [ 'edge135', 'edge134' ],
  vite:config         polyfillModulePreload: true,
  vite:config         modulePreload: { polyfill: false },
  vite:config         outDir: 'dist',
  vite:config         assetsDir: 'assets',
  vite:config         assetsInlineLimit: 4096,
  vite:config         sourcemap: true,
  vite:config         terserOptions: {},
  vite:config         rollupOptions: { platform: 'browser', onwarn: [Function: onwarn] },
  vite:config         commonjsOptions: { include: [ /node_modules/ ], extensions: [ '.js', '.cjs' ] },
  vite:config         dynamicImportVarsOptions: { warnOnError: true, exclude: [ /node_modules/ ] },
  vite:config         write: true,
  vite:config         emptyOutDir: null,
  vite:config         copyPublicDir: true,
  vite:config         manifest: false,
  vite:config         lib: false,
  vite:config         ssrManifest: false,
  vite:config         ssrEmitAssets: false,
  vite:config         reportCompressedSize: false,
  vite:config         chunkSizeWarningLimit: 500,
  vite:config         watch: null,
  vite:config         cssCodeSplit: true,
  vite:config         minify: 'oxc',
  vite:config         ssr: false,
  vite:config         emitAssets: true,
  vite:config         createEnvironment: [Function: createEnvironment],
  vite:config         cssTarget: [ 'edge135', 'edge134' ],
  vite:config         cssMinify: true
  vite:config       },
  vite:config       optimizeDepsPluginNames: []
  vite:config     }
  vite:config   },
  vite:config   configFile: 'D:/repos/react-data-grid/vite.config.ts',
  vite:config   configFileDependencies: [],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     configLoader: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     build: {}
  vite:config   },
  vite:config   root: 'D:/repos/react-data-grid',
  vite:config   decodedBase: '/react-data-grid/',
  vite:config   rawBase: '/react-data-grid/',
  vite:config   publicDir: 'D:/repos/react-data-grid/public',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isWorker: false,
  vite:config   mainConfig: null,
  vite:config   bundleChain: [],
  vite:config   isProduction: true,
  vite:config   css: {
  vite:config     transformer: 'postcss',
  vite:config     preprocessorMaxWorkers: 0,
  vite:config     devSourcemap: false
  vite:config   },
  vite:config   json: { namedExports: true, stringify: 'auto' },
  vite:config   oxc: {
  vite:config     jsxInject: undefined,
  vite:config     include: undefined,
  vite:config     exclude: undefined,
  vite:config     jsx: { development: false, runtime: 'automatic' }
  vite:config   },
  vite:config   builder: undefined,
  vite:config   preview: {
  vite:config     port: 4173,
  vite:config     strictPort: false,
  vite:config     host: undefined,
  vite:config     allowedHosts: [],
  vite:config     https: undefined,
  vite:config     open: true,
  vite:config     proxy: undefined,
  vite:config     cors: {
  vite:config       origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/
  vite:config     },
  vite:config     headers: {}
  vite:config   },
  vite:config   envDir: 'D:/repos/react-data-grid',
  vite:config   env: {
  vite:config     BASE_URL: '/react-data-grid/',
  vite:config     MODE: 'production',
  vite:config     DEV: false,
  vite:config     PROD: true
  vite:config   },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   rawAssetsInclude: [],
  vite:config   logger: {
  vite:config     hasWarned: true,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen],
  vite:config     hasErrorLogged: [Function: hasErrorLogged]
  vite:config   },
  vite:config   packageCache: Map(1) {
  vite:config     'fnpd_D:/repos/react-data-grid' => {
  vite:config       dir: 'D:/repos/react-data-grid',
  vite:config       data: {
  vite:config         name: 'react-data-grid',
  vite:config         version: '7.0.0-beta.52',
  vite:config         license: 'MIT',
  vite:config         description: 'Feature-rich and customizable data grid React component',
  vite:config         keywords: [ 'react', 'data grid' ],
  vite:config         repository: {
  vite:config           type: 'git',
  vite:config           url: 'git+https://github.com/adazzle/react-data-grid.git'
  vite:config         },
  vite:config         bugs: 'https://github.com/adazzle/react-data-grid/issues',
  vite:config         type: 'module',
  vite:config         exports: {
  vite:config           './lib/styles.css': './lib/styles.css',
  vite:config           '.': { types: './lib/index.d.ts', default: './lib/bundle.js' }
  vite:config         },
  vite:config         browser: './lib/bundle.js',
  vite:config         main: './lib/bundle.js',
  vite:config         module: './lib/bundle.js',
  vite:config         types: './lib/index.d.ts',
  vite:config         files: [ 'lib' ],
  vite:config         sideEffects: [ '**/*.css' ],
  vite:config         scripts: {
  vite:config           start: 'vite serve --clearScreen false',
  vite:config           preview: 'vite preview',
  vite:config           'build:website': 'vite build',
  vite:config           build: 'rolldown -c',
  vite:config           'build:types': 'tsc -p tsconfig.lib.json && api-extractor run --local --verbose',
  vite:config           test: 'vitest run',
  vite:config           'test:watch': 'vitest watch',
  vite:config           format: 'biome format --write',
  vite:config           check: 'biome check --error-on-warnings',
  vite:config           'biome:ci': 'biome ci --error-on-warnings',
  vite:config           eslint: 'eslint --max-warnings 0 --cache --cache-location .cache/eslint --cache-strategy content',
  vite:config           'eslint:fix': 'node --run eslint -- --fix',
  vite:config           'prettier:check': 'prettier --check .',
  vite:config           'prettier:format': 'prettier --write .',
  vite:config           typecheck: 'tsc --build',
  vite:config           prepublishOnly: 'npm install && node --run build && node --run build:types',
  vite:config           postpublish: 'git push --follow-tags origin HEAD'
  vite:config         },
  vite:config         dependencies: { clsx: '^2.0.0' },
  vite:config         devDependencies: {
  vite:config           '@babel/preset-typescript': '^7.27.0',
  vite:config           '@biomejs/biome': '1.9.4',
  vite:config           '@eslint/markdown': '^6.3.0',
  vite:config           '@faker-js/faker': '^9.6.0',
  vite:config           '@ianvs/prettier-plugin-sort-imports': '^4.4.1',
  vite:config           '@linaria/core': '^6.3.0',
  vite:config           '@microsoft/api-extractor': '^7.52.2',
  vite:config           '@tanstack/react-router': '^1.114.16',
  vite:config           '@tanstack/router-plugin': '^1.114.16',
  vite:config           '@types/node': '^22.13.16',
  vite:config           '@types/react': '^19.0.12',
  vite:config           '@types/react-dom': '^19.0.3',
  vite:config           '@typescript-eslint/eslint-plugin': '^8.29.0',
  vite:config           '@typescript-eslint/parser': '^8.29.0',
  vite:config           '@vitejs/plugin-react': '^4.4.1',
  vite:config           '@vitest/browser': '^3.1.2',
  vite:config           '@vitest/coverage-v8': '^3.1.2',
  vite:config           '@vitest/eslint-plugin': '^1.1.43',
  vite:config           '@wyw-in-js/rollup': '^0.6.0',
  vite:config           '@wyw-in-js/vite': '^0.6.0',
  vite:config           browserslist: '^4.24.4',
  vite:config           eslint: '^9.23.0',
  vite:config           'eslint-plugin-jest-dom': '^5.5.0',
  vite:config           'eslint-plugin-react': '^7.37.4',
  vite:config           'eslint-plugin-react-compiler': '^19.0.0-beta-e993439-20250328',
  vite:config           'eslint-plugin-react-hooks': '^5.2.0',
  vite:config           'eslint-plugin-react-hooks-extra': '^1.40.1',
  vite:config           'eslint-plugin-sonarjs': '^3.0.2',
  vite:config           'eslint-plugin-testing-library': '^7.1.1',
  vite:config           jspdf: '^3.0.1',
  vite:config           'jspdf-autotable': '^5.0.2',
  vite:config           playwright: '^1.52.0',
  vite:config           postcss: '^8.5.2',
  vite:config           prettier: '3.5.3',
  vite:config           react: '^19.1.0',
  vite:config           'react-dnd': '^16.0.1',
  vite:config           'react-dnd-html5-backend': '^16.0.1',
  vite:config           'react-dom': '^19.1.0',
  vite:config           rolldown: '^1.0.0-beta.8',
  vite:config           typescript: '~5.8.2',
  vite:config           vite: 'npm:rolldown-vite@latest',
  vite:config           vitest: '^3.1.2',
  vite:config           'vitest-browser-react': '^0.1.1'
  vite:config         },
  vite:config         peerDependencies: { react: '^19.0', 'react-dom': '^19.0' }
  vite:config       },
  vite:config       hasSideEffects: [Function: result],
  vite:config       setResolvedCache: [Function: setResolvedCache],
  vite:config       getResolvedCache: [Function: getResolvedCache]
  vite:config     },
  vite:config     set: [Function (anonymous)]
  vite:config   },
  vite:config   worker: { format: 'iife', plugins: '() => plugins', rollupOptions: {} },
  vite:config   appType: 'spa',
  vite:config   experimental: {
  vite:config     importGlobRestoreExtension: false,
  vite:config     hmrPartialAccept: false,
  vite:config     enableNativePlugin: false
  vite:config   },
  vite:config   future: undefined,
  vite:config   ssr: {
  vite:config     target: 'node',
  vite:config     optimizeDeps: { esbuildOptions: { preserveSymlinks: false } },
  vite:config     resolve: { conditions: undefined, externalConditions: undefined }
  vite:config   },
  vite:config   dev: {
  vite:config     warmup: [],
  vite:config     sourcemap: { js: true },
  vite:config     sourcemapIgnoreList: [Function: isInNodeModules$1],
  vite:config     preTransformRequests: false,
  vite:config     createEnvironment: [Function: defaultCreateDevEnvironment],
  vite:config     recoverable: false,
  vite:config     moduleRunnerTransform: false
  vite:config   },
  vite:config   webSocketToken: 'XBoVNy7CtI0S',
  vite:config   getSortedPlugins: [Function: getSortedPlugins],
  vite:config   getSortedPluginHooks: [Function: getSortedPluginHooks],
  vite:config   createResolver: [Function: createResolver],
  vite:config   fsDenyGlob: [Function: arrayMatcher],
  vite:config   safeModulePaths: Set(0) {},
  vite:config   additionalAllowedHosts: []
  vite:config } +99ms
vite v6.3.5 building for production...
transforming (9) node_modules\react\cjs\react-jsx-runtime.production.jstarget was modified to include ES2021 because useDefineForClassFields is set to false and oxc does not support transforming useDefineForClassFields=false for ES2022+ yet
✓ 569 modules transformed.
✗ Build failed in 1.63s
error during build:
Build failed with 1 error:

[plugin vite:oxc-transpile]
Error: 'edge134' is already specified.
    at transformWithOxc (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:10130:19)
    at PluginContextImpl.renderChunk (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:10254:25)
    at PluginContextImpl.handler (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:44535:15)
    at plugin (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:1829:30)
    at plugin.<computed> (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:2171:18)
    at normalizeErrors (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:935:18) 
    at handleOutputErrors (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:1758:34)
    at transformToRollupOutput (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:1752:2)
    at RolldownBuild.write (file:///D:/repos/react-data-grid/node_modules/rolldown/dist/shared/src-B53PXEqn.mjs:4168:11)
    at async buildEnvironment (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:44210:16)
    at async Object.defaultBuildApp [as buildApp] (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-BNGwMvHG.js:44714:5)
    at async CAC.<anonymous> (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/cli.js:863:7)

Validations

@nstepien nstepien changed the title Crash with configured build,target Crash with configured build.target Apr 24, 2025
@TheAlexLichter
Copy link
Collaborator

TheAlexLichter commented Apr 25, 2025

This could be a bit more resilient (or at least give a better error message) - but the target set in the example is ambiguous. Should it be transformed for targeting chrome135 or chrome134 (same would happen when setting target: ['es2020', 'esnext']?

I see merit in having a better behavior there, especially as you the default browserslist is used. Raised it in oxc-project/oxc#10618

As a workaround, you can dedupe the browsers and remove non-supported for now.

Old:

I'd guess this is a side effect of using useDefineForClassFields: false in the tsconfig.

target was modified to include ES2021 because useDefineForClassFields is set to false and oxc does not support transforming useDefineForClassFields=false for ES2022+ yet

The automated target adaption should keep custom ones into account.

@nstepien
Copy link
Author

Should it be transformed for targeting chrome135 or chrome134

It should target both. While unlikely, it's not impossible that a feature that was enabled in an older version of a browser may have been disabled in a newer version of the same browser.

I think the transformer should consider multiple versions as separate browsers, just like when targeting multiple browsers like chrome/edge/safari/firefox in the same target.

@nstepien
Copy link
Author

@sapphi-red sapphi-red added the bug: upstream Bug in a dependency of Vite label Apr 26, 2025
@Boshen
Copy link

Boshen commented Apr 28, 2025

Regarding this error, I did some logging and testing in esbuild:

https://github.com/evanw/esbuild/blob/5959289d90667c5a4026e6fb32cc58bbed9fc88a/pkg/api/api_impl.go#L360

	fmt.Println(targetEnv)
 make esbuild && ./esbuild --target="chrome125,chrome120,es2015,es2022" test.js
"chrome120", "es2022"
make esbuild && ./esbuild --target="chrome120,chrome125,es2022,es2015" test.js
"chrome125", "es2015"

It resolves to the last value.

Testing in the playground:

--target=es2022,es2015 transforms: https://esbuild.github.io/try/#dAAwLjI0LjAALS10YXJnZXQ9ZXMyMDI0LGVzMjAxNQBhID8/IGI

--target=es2015,es2024 does not transform: https://esbuild.github.io/try/#dAAwLjI0LjAALS10YXJnZXQ9ZXMyMDE1LGVzMjAyNABhID8/IGI


So to our surprise, esbuild just picks the last value for the target.

I'm in favor of keeping the current behavior (report Error: 'chrome134' is already specified.) to remove the ambiguity.

I can report this to esbuild to surface the problem.

@TheAlexLichter
Copy link
Collaborator

I think this is reasonable as it might unveil unwanted/implicit behavior. A workaround seems also not too difficult (given you could set latest version only in browserslist).

cc @sapphi-red this should probably be added to #84 as known limitation

@nstepien
Copy link
Author

So using last 2 xxx versions with browserslist will always crash rolldown-vite?
I believe browserslist configs will generally generate browser lists with multiple versions of the same browser, so this is a significant limitation IMO.

Is it not possible to treat those as separate browsers, and transform code so that the full browser matrix can be supported?

I don't think esbuild's behavior should be preserved either.

@Boshen
Copy link

Boshen commented Apr 28, 2025

It would be a breaking change if we do differently with esbuild, so I'm happy to:

  • align with esbuild and keep the ambiguity for now; report the problem to esbuild to understand whether it's a bug in esbuild or not
  • keep this as it, report error and let the user remove the ambiguity

@nstepien
Copy link
Author

I don't think it's that much of a breaking change 🤷‍♂

@sapphi-red sapphi-red changed the title Crash with configured build.target Crash when multiple versions of same browser is specified in build.target Apr 29, 2025
@sapphi-red sapphi-red changed the title Crash when multiple versions of same browser is specified in build.target Errors when multiple versions of same browser is specified in build.target Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: upstream Bug in a dependency of Vite
Projects
None yet
Development

No branches or pull requests

4 participants