Production build fails in runtime after update to 2.7.1
See original GitHub issueDescribe the bug
We observe broken production builds with an update of Vite from 2.6.14 to 2.7.1
As seen on reproduction there seems to be some too aggressive tree shaking occurring during the build phase. Vendor file size reduced from 2041.35 KiB to 669.87 KiB. Production build is broken with the same error no matter what minification option we choose: ‘terser’, ‘esbuild’ or ‘false’
I’m not sure is it possible to reproduce the error without devextreme
package, but our whole setup Vite+Vue3+devextreme-vue
has worked pretty well for quite a long time.
Reproduction
Here is a repo with repro: https://github.com/SlyNet/devexpress-vite-repro
With Vite 2.6.14
npm i vite@2.6.14
npm run build
npm run serve
dist/assets/index.9eb36237.js 4.27 KiB / gzip: 1.83 KiB
dist/assets/index.b831ffbc.css 751.70 KiB / gzip: 101.36 KiB
dist/assets/vendor.135cef2e.js 2041.35 KiB / gzip: 563.28 KiB
Navigate to http://localhost:5000 - there is datagrid loaded, no console errors
With Vite 2.7.1
npm i vite@2.7.1
npm run build
npm run serve
dist/assets/index.02804fb9.js 4.27 KiB / gzip: 1.83 KiB
dist/assets/index.b831ffbc.css 751.70 KiB / gzip: 101.36 KiB
dist/assets/vendor.26bf90b8.js 669.87 KiB / gzip: 185.42 KiB
Observe some drastic changes in vendor lib size.
Navigate to http://localhost:5000 - there is console errors"
vendor.26bf90b8.js:5230 TypeError: Cannot read properties of undefined (reading 'render')
at inheritor._initMarkup (:5000/assets/vendor.26bf90b8.js:32373)
at inheritor._initMarkup (:5000/assets/vendor.26bf90b8.js:7411)
at inheritor._renderComponent (:5000/assets/vendor.26bf90b8.js:12555)
at inheritor._updateDOMComponent (:5000/assets/vendor.26bf90b8.js:12778)
at inheritor.endUpdate (:5000/assets/vendor.26bf90b8.js:12787)
at inheritor.endUpdate (:5000/assets/vendor.26bf90b8.js:7411)
at inheritor.endUpdate (:5000/assets/vendor.26bf90b8.js:14433)
at inheritor.endUpdate (:5000/assets/vendor.26bf90b8.js:7411)
at inheritor.endUpdate (:5000/assets/vendor.26bf90b8.js:32405)
at inheritor.endUpdate (:5000/assets/vendor.26bf90b8.js:7411)
logError @ vendor.26bf90b8.js:5230
vendor.26bf90b8.js:32364 Uncaught TypeError: this.updateDimensions is not a function
at inheritor._dimensionChanged (:5000/assets/vendor.26bf90b8.js:32364)
at inheritor._dimensionChanged (:5000/assets/vendor.26bf90b8.js:7411)
at Callback._fireCore (:5000/assets/vendor.26bf90b8.js:7576)
at Callback.fireWith (:5000/assets/vendor.26bf90b8.js:7628)
at Callback.fire (:5000/assets/vendor.26bf90b8.js:7636)
at handleResize (:5000/assets/vendor.26bf90b8.js:10697)
System Info
System:
OS: Windows 10 10.0.22000
CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
Memory: 26.80 GB / 63.94 GB
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.2.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 96.0.4664.93
Edge: Spartan (44.22000.120.0), Chromium (96.0.1054.43)
Internet Explorer: 11.0.22000.120
npmPackages:
@vitejs/plugin-vue: ^1.10.2 => 1.10.2
vite: ^2.6.14 => 2.6.14
Used Package Manager
npm
Logs
vite:config bundled config file loaded in 98.18ms +0ms
vite:config using resolved config: {
vite:config plugins: [
vite:config 'alias',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-script-proxy',
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 'vite:vue',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:watch-package-data',
vite:config 'vite:build-html',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'rollup-plugin-dynamic-import-variables',
vite:config 'vite:asset-import-meta-url',
vite:config 'vite:build-import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:reporter',
vite:config 'vite:load-fallback'
vite:config ],
vite:config build: {
vite:config target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
vite:config polyfillModulePreload: true,
vite:config outDir: 'C:\\src\\exp\\devexpress-vite-repro\\dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: true,
vite:config cssTarget: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
vite:config sourcemap: false,
vite:config rollupOptions: { input: 'C:\\src\\exp\\devexpress-vite-repro\\index.html' },
vite:config minify: 'esbuild',
vite:config terserOptions: {},
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 reportCompressedSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null,
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
vite:config },
vite:config define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
vite:config ssr: { external: [ 'vue', '@vue/server-renderer' ] },
vite:config configFile: 'C:/src/exp/devexpress-vite-repro/vite.config.js',
vite:config configFileDependencies: [ 'vite.config.js' ],
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:/src/exp/devexpress-vite-repro',
vite:config base: '/',
vite:config resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
vite:config publicDir: 'C:\\src\\exp\\devexpress-vite-repro\\public',
vite:config cacheDir: 'C:\\src\\exp\\devexpress-vite-repro\\node_modules\\.vite',
vite:config command: 'build',
vite:config mode: 'production',
vite:config isProduction: true,
vite:config server: { fs: { strict: true, allow: [Array], deny: [Array] } },
vite:config preview: {
vite:config port: undefined,
vite:config strictPort: undefined,
vite:config host: undefined,
vite:config https: undefined,
vite:config open: undefined,
vite:config proxy: undefined,
vite:config cors: undefined
vite:config },
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 warnOnce: [Function: warnOnce],
vite:config error: [Function: error],
vite:config clearScreen: [Function: clearScreen],
vite:config hasErrorLogged: [Function: hasErrorLogged]
vite:config },
vite:config packageCache: Map(0) { set: [Function (anonymous)] },
vite:config createResolver: [Function: createResolver],
vite:config optimizeDeps: {
vite:config esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
vite:config }
vite:config } +6ms
vite v2.7.1 building for production...
transforming (258) node_modules\devextreme\esm\ui\grid_core\ui.grid_core.editing.js vite:resolve 1.00ms icons/dxicons.woff2 -> C:/src/exp/devexpress-vite-repro/node_modules/devextreme/dist/css/icons/dxicons.woff2 +0ms
transforming (286) node_modules\devextreme\esm\ui\grid_core\ui.grid_core.focus.js vite:resolve 0.55ms icons/dxicons.woff -> C:/src/exp/devexpress-vite-repro/node_modules/devextreme/dist/css/icons/dxicons.woff +100ms
transforming (324) node_modules\devextreme\esm\core\action.js vite:resolve 0.39ms icons/dxicons.ttf -> C:/src/exp/devexpress-vite-repro/node_modules/devextreme/dist/css/icons/dxicons.ttf +80ms
✓ 634 modules transformed.
dist/assets/dxicons.0fbdad07.woff2 13.09 KiB
dist/assets/dxicons.2e6989bc.woff 16.60 KiB
dist/assets/dxicons.880c49de.ttf 32.73 KiB
dist/index.html 0.48 KiB
dist/assets/index.02804fb9.js 4.27 KiB / gzip: 1.83 KiB
dist/assets/index.b831ffbc.css 751.70 KiB / gzip: 101.36 KiB
dist/assets/vendor.26bf90b8.js 669.87 KiB / gzip: 185.42 KiB
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.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:12 (1 by maintainers)
Top GitHub Comments
I’m experiencing the same issue, a workaround for the
devextreme
package is to add the following resolve.alias configuration:{ "devextreme/ui": 'devextreme/esm/ui' }
Beware that this will only work for the
devextreme
package as it depends on the internal structure of the package.Caused by this commit: https://github.com/vitejs/vite/pull/5665