nklayman / vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron
https://nklayman.github.io/vue-cli-plugin-electron-builder/
MIT License
4.12k stars 278 forks source link

Build failed with `constantViolations` #1610

Closed dipenchand closed 2 years ago

dipenchand commented 2 years ago

Describe the bug When I tried to build pro-antdv project with electron-builder, it fails with constantViolations Error. But it works with yarn electron:serve command

To Reproduce yarn electron:build

Screenshots

 error  in ./src/views/user/RegisterResult.vue?vue&type=script&lang=js&

Syntax Error: TypeError: /.../src/views/user/RegisterResult.vue: Cannot read property 'constantViolations' of undefined

 @ ./src/views/user/RegisterResult.vue?vue&type=script&lang=js& 1:0-343 1:359-362 1:364-704 1:364-704
 @ ./src/views/user/RegisterResult.vue
 @ ./src/config/router.config.js
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi ./src/main.js

 ERROR  Vue CLI build failed. Please resolve any issues with your build and try again.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment (please complete the following information): Output from vue info

Environment Info:
  System:
    OS: macOS 12.0.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 14.18.2 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
  Browsers:
    Chrome: 96.0.4664.55
    Edge: 96.0.1054.41
    Firefox: Not Found
    Safari: 15.1
  npmPackages:
    @ant-design/icons-vue:  2.0.0 
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1 
    @vue/babel-helper-vue-transform-on:  1.0.2 
    @vue/babel-plugin-jsx:  1.1.1 
    @vue/babel-plugin-transform-vue-jsx:  1.2.1 
    @vue/babel-preset-app:  4.5.15 
    @vue/babel-preset-jsx:  1.2.4 
    @vue/babel-sugar-composition-api-inject-h:  1.2.1 
    @vue/babel-sugar-composition-api-render-instance:  1.2.4 
    @vue/babel-sugar-functional-vue:  1.2.2 
    @vue/babel-sugar-inject-h:  1.2.2 
    @vue/babel-sugar-v-model:  1.2.3 
    @vue/babel-sugar-v-on:  1.2.3 
    @vue/cli-overlay:  4.5.15 
    @vue/cli-plugin-babel: ^4.0.4 => 4.5.15 
    @vue/cli-plugin-eslint: ^4.0.4 => 4.5.15 
    @vue/cli-plugin-router: ^4.0.4 => 4.5.15 
    @vue/cli-plugin-unit-jest: ^4.0.4 => 4.5.15 
    @vue/cli-plugin-vuex: ^4.0.4 => 4.5.15 
    @vue/cli-service: ^4.0.4 => 4.5.15 
    @vue/cli-shared-utils:  4.5.15 
    @vue/component-compiler-utils:  3.3.0 
    @vue/eslint-config-standard: ^4.0.0 => 4.0.0 
    @vue/preload-webpack-plugin:  1.1.2 
    @vue/test-utils: ^1.0.0-beta.29 => 1.2.2 
    @vue/web-component-wrapper:  1.3.0 
    ant-design-vue: ^1.7.6 => 1.7.8 
    babel-helper-vue-jsx-merge-props:  2.0.3 
    eslint-plugin-vue: ^5.2.3 => 5.2.3 
    jest-serializer-vue:  2.0.2 
    viser-vue: ^2.4.6 => 2.4.8 
    vue: ^2.6.10 => 2.6.14 
    vue-cli-plugin-electron-builder: ~2.1.1 => 2.1.1 
    vue-clipboard2: ^0.2.1 => 0.2.1 
    vue-container-query:  0.1.0 
    vue-copy-to-clipboard:  1.0.3 
    vue-cropper: 0.4.9 => 0.4.9 
    vue-eslint-parser:  5.0.0 
    vue-google-adsense:  1.10.1 
    vue-hot-reload-api:  2.3.4 
    vue-html-to-paper: ^1.4.3 => 1.4.3 
    vue-i18n: ^8.17.4 => 8.26.5 
    vue-jest:  3.0.7 
    vue-loader:  15.9.8 (16.8.2)
    vue-print-nb: ^1.7.5 => 1.7.5 
    vue-quill-editor: ^3.0.6 => 3.0.6 
    vue-ref:  2.0.0 
    vue-router: ^3.1.2 => 3.5.3 
    vue-style-loader:  4.1.3 
    vue-svg-component-builder:  2.0.3 
    vue-svg-component-runtime: ^1.0.1 => 1.0.1 
    vue-svg-icon-loader: ^2.1.1 => 2.1.1 
    vue-template-compiler: ^2.6.10 => 2.6.14 
    vue-template-es2015-compiler:  1.9.1 
    vue-tiny-lazyload-img: ^0.1.0 => 0.1.0 
    vuex: ^3.1.1 => 3.6.2 
  npmGlobalPackages:
    @vue/cli: 4.5.15

Additional Context https://github.com/vueComponent/ant-design-vue-pro

dipenchand commented 2 years ago

I've read the documentation. And it is solved by using --legacy argument while building.