vue-cli-plugin-electron-builder icon indicating copy to clipboard operation
vue-cli-plugin-electron-builder copied to clipboard

Cannot build with `test` mode

Open undergroundwires opened this issue 2 years ago • 2 comments

Tested using

  • export NODE_ENV=test & npm run electron:build -- --publish never
  • vue-cli-service electron:build "--publish" "never" "--mode" "test"

Both fails with:

 ERROR  WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.mode should be one of these:
   "development" | "production" | "none"
   -> Enable production optimizations or development hints.
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.mode should be one of these:
   "development" | "production" | "none"
   -> Enable production optimizations or development hints.
    at webpack (/home/bob/user/dev/undergroundwires/privacy.sexy/node_modules/webpack/lib/webpack.js:31:9)
    at bundleMain (/home/bob/user/dev/undergroundwires/privacy.sexy/node_modules/vue-cli-plugin-electron-builder/index.js:699:17)
    at /home/bob/user/dev/undergroundwires/privacy.sexy/node_modules/vue-cli-plugin-electron-builder/index.js:180:49
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

However they're officially supported Vue modes https://cli.vuejs.org/guide/mode-and-env.html and should be supported with vue-cli-plugin-electron-builder too. Maybe we could separate what's being sent to Vue to build and what we use as NODE_ENV to build?

It could also resolve #1626.

I believe it's reproducible with any repository, but I tested with privacy.sexy:

  1. git clone https://github.com/undergroundwires/privacy.sexy.git
  2. git checkout 0.11.3 (because master is subject to change`
  3. Run any of commands mentioned here.

undergroundwires avatar Dec 28 '21 19:12 undergroundwires

NODE_ENV is used to set the webpack mode. What's causing the issue is that --mode test sets NODE_ENV to test as well which webpack doesn't like. I'll fix this in v3, and I can backport it to v2 and release a hotfix if you need it. You can also create a .env.test file with NODE_ENV=production to fix this.

nklayman avatar Jan 06 '22 22:01 nklayman

Thanks. Happy to see you back. You're empowering majority of Vue desktop ecosystem behind the scenes and your work is much appreciated.

undergroundwires avatar Mar 06 '22 18:03 undergroundwires