Skip to content
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

Production build fails in runtime after update to 2.7.1 #6061

Closed
7 tasks done
alfeg opened this issue Dec 10, 2021 · 12 comments
Closed
7 tasks done

Production build fails in runtime after update to 2.7.1 #6061

alfeg opened this issue Dec 10, 2021 · 12 comments
Labels
inconsistency Inconsistency between dev & build p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release

Comments

@alfeg
Copy link

alfeg commented Dec 10, 2021

Describe 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

@Niputi Niputi added plugin: vue regression The issue only appears after a new release labels Dec 10, 2021
@jzs11
Copy link

jzs11 commented Dec 10, 2021

Same problem here.

@jzs11
Copy link

jzs11 commented Dec 15, 2021

Any update on it?

@alfeg
Copy link
Author

alfeg commented Dec 23, 2021

Verified on Vite v2.7.6 - issue is still reproduced

@sodatea
Copy link
Member

sodatea commented Dec 23, 2021

Caused by this commit: #5665

@sodatea sodatea added bug inconsistency Inconsistency between dev & build p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage plugin: vue labels Dec 23, 2021
@oschwede
Copy link

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.

@alfeg
Copy link
Author

alfeg commented Jan 18, 2022

@oschwede Thanks!

I can confirm that this workaround is working (this may mean that there will be no proper fix for some time)

@jzs11
Copy link

jzs11 commented Jan 18, 2022

Thanks! It is working with this workaround, but I do feel we need to address it properly. It was a regression and we know which one caused it.

@dezinerdude
Copy link

Still the same issue with Vite 2.9.1. Workaround no longer seems to work either :(

@amitShimon1983
Copy link

amitShimon1983 commented Jul 6, 2022

i having the same problem, after production build im getting Uncaught TypeError: Cannot read properties of undefined (reading 'prototype') how can I fix it?

Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
at ParserRuleContext.js:56:57 this is from antlr4 library

@alfeg
Copy link
Author

alfeg commented Jul 6, 2022

Still the same issue with Vite 2.9.1. Workaround no longer seems to work either :(

No issue for us. Workaround works perfectly.

@amitShimon1983
Copy link

How can i solve this?

@alex2600
Copy link

alex2600 commented Dec 1, 2022

Similar issue here with Vite>v2.6:

Uncaught TypeError: Cannot read properties of undefined (reading 'modules')  
    at _sfc_main.setup (App.vue:8:2)

Don't know how to fix this.

Running with Vite v2.6 until #9170 is released. Hope this will fix the problem.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
inconsistency Inconsistency between dev & build p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants