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

Use --mode argument to be consistent with Vue CLI

Open undergroundwires opened this issue 2 years ago • 2 comments

Vue CLI uses --mode argument to set NODE_ENV however we do the opposite here.

It would be nice to be part of Vue convention, this way users can except similar behavior to npm run electron:build just like npm run build and set the environment in a unified consistent way.

It would also simplify understanding of how vue-cli-service build is called internally.

Unidentical APIs also cause a bug/limitation like #1627

undergroundwires avatar Dec 28 '21 19:12 undergroundwires

I'm not sure what you mean by "we do the opposite here," can you elaborate a bit more?

nklayman avatar Jan 06 '22 22:01 nklayman

I'm sorry for my bad formulation.

Vue CLI uses --mode to set NODE_ENV for e.g. webpack.

vue-cli-plugin-electron-builder uses NODE_ENV to set --mode.

A code snippet example I found is here.

So as a workaround, I set both:

mode='production'
npm install --global cross-env
cross-env-shell NODE_ENV="$mode"
npm run electron:build -- --publish never --mode "$mode"

But it would be nice to be able to skip setting NODE_ENV environment variable and rely on --mode only.

undergroundwires avatar Mar 06 '22 18:03 undergroundwires