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

Uncaught TypeError: Cannot read property 'constant' of undefined #3997

Closed
6 tasks done
jzwyz opened this issue Jun 28, 2021 · 5 comments · Fixed by #4015
Closed
6 tasks done

Uncaught TypeError: Cannot read property 'constant' of undefined #3997

jzwyz opened this issue Jun 28, 2021 · 5 comments · Fixed by #4015

Comments

@jzwyz
Copy link

jzwyz commented Jun 28, 2021

Describe the bug

Upgrade vite to 2.3.8, access to the packaged program through the preview will report an error
Suspected lodash-es is not included
image

image

Reproduction

codesandbox

github

System Info

System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 39.30 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.4 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.10 - /usr/local/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Safari: 14.1.1

Used Package Manager

npm

Logs

➜  demo-vite npm run build

> @0.0.1 build /Users/jason/myworkspace/demo-vite
> vuedx-typecheck . && vite build --debug

Running for /Users/jason/myworkspace/demo-vite

Found 0 errors.  vite:config bundled config file loaded in 704ms +0ms
  vite:config using resolved config: {
  vite:config   resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
  vite:config   plugins: [
  vite:config     'alias',
  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     'vite:vue',
  vite:config     'vue-jsx',
  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     'vite:style-import',
  vite:config     'vite:import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:reporter'
  vite:config   ],
  vite:config   css: { preprocessorOptions: { less: [Object] } },
  vite:config   server: {
  vite:config     proxy: {
  vite:config       '/api': [Object],
  vite:config       '/login': [Object],
  vite:config       '/logout': [Object],
  vite:config       '/decision': [Object]
  vite:config     },
  vite:config     fsServe: { root: '/Users/jason/myworkspace/demo-vite', strict: false }
  vite:config   },
  vite:config   optimizeDeps: {
  vite:config     include: [ 'lodash-es' ],
  vite:config     esbuildOptions: { keepNames: undefined }
  vite:config   },
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillDynamicImport: false,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  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     watch: null
  vite:config   },
  vite:config   define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
  vite:config   ssr: { external: [ 'vue', '@vue/server-renderer' ] },
  vite:config   esbuild: { include: /\.ts$/ },
  vite:config   configFile: '/Users/jason/myworkspace/demo-vite/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: '/Users/jason/myworkspace/demo-vite',
  vite:config   base: '/',
  vite:config   publicDir: '/Users/jason/myworkspace/demo-vite/public',
  vite:config   cacheDir: '/Users/jason/myworkspace/demo-vite/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  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   },
  vite:config   createResolver: [Function: createResolver]
  vite:config } +9ms
vite v2.3.8 building for production...
transforming (2674) src/components/market_size/DeepdiveCombinationChart.vue  vite:resolve 1ms   ../../style/themes/index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/themes/index.less +0ms
  vite:resolve 1ms   ../../style/mixins/index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/index.less +0ms
  vite:resolve 2ms   ./default.less -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/themes/default.less +6ms
  vite:resolve 2ms   size -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/size.less +0ms
  vite:resolve 2ms   compatibility -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/compatibility.less +0ms
  vite:resolve 2ms   clearfix -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/clearfix.less +0ms
  vite:resolve 2ms   iconfont -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/iconfont.less +0ms
  vite:resolve 2ms   motion -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/motion.less +0ms
  vite:resolve 2ms   reset -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/reset.less +0ms
  vite:resolve 1ms   operation-unit -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/operation-unit.less +0ms
  vite:resolve 1ms   typography -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/typography.less +0ms
  vite:resolve 1ms   box -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/box.less +0ms
  vite:resolve 1ms   modal-mask -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/modal-mask.less +0ms
  vite:resolve 9ms   ../color/colors -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/color/colors.less +47ms
  vite:resolve 5ms   ../themes/index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/themes/index.less +0ms
  vite:resolve 4ms   ../../style/themes/default -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/themes/default.less +0ms
  vite:resolve 1ms   colorPalette -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/color/colorPalette.less +13ms
  vite:resolve 0ms   bezierEasing -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/color/bezierEasing.less +3ms
  vite:resolve 0ms   tinyColor -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/color/tinyColor.less +0ms
transforming (3036) node_modules/ant-design-vue/es/date-picker/style/index.js  vite:resolve 1ms   ../../style/themes/index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/themes/index.less +514ms
  vite:resolve 1ms   ../../input/style/mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/input/style/mixin.less +0ms
transforming (3041) node_modules/ant-design-vue/es/message/style/index.less  vite:resolve 0ms   ./themes/index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/themes/index.less +289ms
  vite:resolve 1ms   ./core/index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/index.less +1ms
  vite:resolve 1ms   ../mixins/index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/index.less +2ms
  vite:resolve 1ms   base -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/base.less +0ms
  vite:resolve 1ms   global -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/global.less +0ms
  vite:resolve 1ms   iconfont -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/iconfont.less +0ms
  vite:resolve 2ms   motion -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/motion.less +1ms
  vite:resolve 3ms   ../mixins/iconfont -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/iconfont.less +21ms
  vite:resolve 2ms   ../mixins/motion -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/mixins/motion.less +0ms
  vite:resolve 2ms   motion/fade -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/motion/fade.less +0ms
  vite:resolve 2ms   motion/move -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/motion/move.less +0ms
  vite:resolve 2ms   motion/other -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/motion/other.less +0ms
  vite:resolve 2ms   motion/slide -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/motion/slide.less +0ms
  vite:resolve 2ms   motion/swing -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/motion/swing.less +0ms
  vite:resolve 3ms   motion/zoom -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/style/core/motion/zoom.less +1ms
transforming (3200) src/components/layout/LayoutSiderMenu.vue  vite:resolve 2ms   ../../button/style/mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/button/style/mixin.less +580ms
  vite:resolve 2ms   Picker -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/Picker.less +0ms
  vite:resolve 2ms   Calendar -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/Calendar.less +0ms
  vite:resolve 2ms   RangePicker -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/RangePicker.less +0ms
  vite:resolve 2ms   TimePicker -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/TimePicker.less +0ms
  vite:resolve 2ms   MonthPanel -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/MonthPanel.less +0ms
  vite:resolve 2ms   YearPanel -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/YearPanel.less +0ms
  vite:resolve 2ms   DecadePanel -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/DecadePanel.less +0ms
  vite:resolve 2ms   MonthPicker -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/MonthPicker.less +0ms
  vite:resolve 3ms   WeekPicker -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/date-picker/style/WeekPicker.less +1ms
transforming (3345) node_modules/ant-design-vue/es/config-provider/style/index.less  vite:resolve 1ms   ./modal -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/modal/style/modal.less +1s
  vite:resolve 1ms   ./confirm -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/modal/style/confirm.less +0ms
  vite:resolve 1ms   ./light -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/layout/style/light.less +82ms
transforming (3518) src/components/grab_setting/share_monitor/ShareMonitorModalFormTop100.vue  vite:resolve 0ms   ./dark -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/menu/style/dark.less +751ms
transforming (3531) node_modules/ant-design-vue/es/popconfirm/style/index.js  vite:resolve 1ms   ../../grid/style/mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/grid/style/mixin.less +442ms
  vite:resolve 1ms   ./mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/form/style/mixin.less +0ms
transforming (3696) src/components/market_size/dashboard/DetailedComparison.vue  vite:resolve 1ms   ../../tree/style/mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/tree/style/mixin.less +338ms
  vite:resolve 1ms   ../../checkbox/style/mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/checkbox/style/mixin.less +0ms
  vite:resolve 0ms   ./affix -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/input/style/affix.less +83ms
  vite:resolve 0ms   ./mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/input/style/mixin.less +0ms
  vite:resolve 0ms   ./search-input -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/input/style/search-input.less +0ms
  vite:resolve 5ms   ./index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/input/style/index.less +9ms
  vite:resolve 1ms   ./single -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/select/style/single.less +163ms
  vite:resolve 1ms   ./multiple -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/select/style/multiple.less +0ms
  vite:resolve 1ms   ./rtl -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/select/style/rtl.less +0ms
  vite:resolve 5ms   ./index -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/select/style/index.less +12ms
  vite:resolve 0ms   ./mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/checkbox/style/mixin.less +156ms
  vite:resolve 0ms   ./mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/button/style/mixin.less +107ms
transforming (3717) node_modules/d3-color/src/index.js  vite:resolve 0ms   ./size -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/table/style/size.less +345ms
transforming (3748) node_modules/ant-design-vue/es/spin/style/index.less  vite:resolve 0ms   ./mixin -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/grid/style/mixin.less +377ms
  vite:resolve 1ms   ./rtl -> /Users/jason/myworkspace/demo-vite/node_modules/ant-design-vue/es/grid/style/rtl.less +1ms
transforming (3759) node_modules/ant-design-vue/es/statistic/style/index.lessConflicting namespaces: "node_modules/@antv/g-canvas/esm/index.js" re-exports "version" from both "node_modules/@antv/g-canvas/esm/index.js" and "node_modules/@antv/g-base/esm/index.js" (will be ignored)
✓ 3807 modules transformed.

Validations

@github-actions
Copy link

Hello @jzwyz. Please provide a online reproduction by codesandbox or a minimal GitHub repository. Issues labeled by need reproduction will be closed if no activities in 3 days.

@jzwyz
Copy link
Author

jzwyz commented Jun 29, 2021

@sodatea

Reproduction

codesandbox

github

@jzwyz
Copy link
Author

jzwyz commented Jun 29, 2021

npm run dev can be accessed normally.

The code after npm run build cannot be accessed through npm run serve preview.

Putting dist in nginx also can't access

Check the browser console and throw the above exception:

vendor.0ad737d0.js:31 Uncaught TypeError: Cannot read property 'constant' of undefined

This problem exists in vite versions after 2.2.4

@haoqunjiang
Copy link
Member

Same as #3426 (comment)

@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants