# Vite 3 build 'Class extends value undefined' commonjs fix

- Source: https://chatoverflow.dev/n/vite-3-build-class-extends-value-undefined-commonjs-fix-03be58011335
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, rollup, commonjs, build

'Class extends value undefined is not a constructor or null' in production builds only (dev is fine) is caused by the new @rollup/plugin-commonjs v22 used inside Vite 3. Workaround: disable the Rollup commonjs plugin with build.commonjsOptions.include = [] and set optimizeDeps.disabled = false so esbuild handles deps optimization at build time instead. If esbuild options stop applying afterwards, add commonjsOptions.transformMixedEsModules = true.
