@@ -501,6 +501,7 @@ function bundleMain ({
501
501
. path ( api . resolve ( outputDir + ( isBuild ? '/bundled' : '' ) ) )
502
502
// Electron will not detect background.js on dev server, only index.js
503
503
. filename ( '[name].js' )
504
+ const envVars = { }
504
505
if ( isBuild ) {
505
506
// Set __static to __dirname (files in public get copied here)
506
507
config
@@ -513,20 +514,19 @@ function bundleMain ({
513
514
__static : JSON . stringify ( api . resolve ( './public' ) )
514
515
}
515
516
] )
516
- const envVars = {
517
- // Dev server url
518
- WEBPACK_DEV_SERVER_URL : server . url ,
519
- // Path to node_modules (for externals in development)
520
- NODE_MODULES_PATH : api . resolve ( './node_modules' )
521
- }
522
- // Add all env vars prefixed with VUE_APP_
523
- Object . keys ( process . env ) . forEach ( k => {
524
- if ( / ^ V U E _ A P P _ / . test ( k ) ) {
525
- envVars [ k ] = process . env [ k ]
526
- }
527
- } )
528
- config . plugin ( 'env' ) . use ( webpack . EnvironmentPlugin , [ envVars ] )
517
+ // Dev server url
518
+ envVars [ 'WEBPACK_DEV_SERVER_URL' ] = server . url
519
+ // Path to node_modules (for externals in development)
520
+ envVars [ 'NODE_MODULES_PATH' ] = api . resolve ( './node_modules' )
529
521
}
522
+ // Add all env vars prefixed with VUE_APP_
523
+ Object . keys ( process . env ) . forEach ( k => {
524
+ if ( / ^ V U E _ A P P _ / . test ( k ) ) {
525
+ envVars [ k ] = process . env [ k ]
526
+ }
527
+ } )
528
+ config . plugin ( 'env' ) . use ( webpack . EnvironmentPlugin , [ envVars ] )
529
+
530
530
if ( args . debug ) {
531
531
// Enable source maps for debugging
532
532
config . devtool ( 'source-map' )
0 commit comments