@@ -229,59 +229,60 @@ module.exports = (api, options) => {
229
229
. options ( { transpileOnly : ! mainProcessTypeChecking } )
230
230
}
231
231
232
- // Build the main process
233
- const bundle = webpack ( mainProcessChain ( mainConfig ) . toConfig ( ) )
234
- console . log ( 'Bundling main process:\n' )
235
- bundle . run ( ( err , stats ) => {
236
- if ( err ) {
237
- console . error ( err . stack || err )
238
- if ( err . details ) {
239
- console . error ( err . details )
232
+ console . log ( '\nStarting development server:\n' )
233
+ // Run the serve command with custom webpack config
234
+ serve (
235
+ {
236
+ _ : [ ] ,
237
+ // Use dashboard if called from ui
238
+ dashboard : args . dashboard ,
239
+ // Serve in development mode if launched in headless mode
240
+ mode : args . headless && ! args . forceDev ? 'production' : 'development'
241
+ } ,
242
+ api ,
243
+ options ,
244
+ rendererConfig
245
+ ) . then ( server => {
246
+ // Set dev server url
247
+ mainConfig
248
+ . plugin ( 'env' )
249
+ . tap ( args => [ { ...args , WEBPACK_DEV_SERVER_URL : server . url } ] )
250
+ // Build the main process
251
+ const bundle = webpack ( mainProcessChain ( mainConfig ) . toConfig ( ) )
252
+ console . log ( 'Bundling main process:\n' )
253
+ bundle . run ( ( err , stats ) => {
254
+ if ( err ) {
255
+ console . error ( err . stack || err )
256
+ if ( err . details ) {
257
+ console . error ( err . details )
258
+ }
259
+ process . exit ( 1 )
240
260
}
241
- process . exit ( 1 )
242
- }
243
261
244
- const info = stats . toJson ( )
262
+ const info = stats . toJson ( )
245
263
246
- if ( stats . hasErrors ( ) ) {
247
- console . error ( info . errors )
248
- process . exit ( 1 )
249
- }
264
+ if ( stats . hasErrors ( ) ) {
265
+ console . error ( info . errors )
266
+ process . exit ( 1 )
267
+ }
250
268
251
- if ( stats . hasWarnings ( ) ) {
252
- console . warn ( info . warnings )
253
- }
269
+ if ( stats . hasWarnings ( ) ) {
270
+ console . warn ( info . warnings )
271
+ }
254
272
255
- console . log (
256
- stats . toString ( {
257
- chunks : false ,
258
- colors : true
259
- } )
260
- )
261
- console . log ( '\nStarting development server:\n' )
262
- // Run the serve command with custom webpack config
263
- serve (
264
- {
265
- _ : [ ] ,
266
- // Use dashboard if called from ui
267
- dashboard : args . dashboard ,
268
- // Serve in development mode if launched in headless mode
269
- mode : args . headless && ! args . forceDev ? 'production' : 'development'
270
- } ,
271
- api ,
272
- options ,
273
- rendererConfig
274
- ) . then ( server => {
273
+ console . log (
274
+ stats . toString ( {
275
+ chunks : false ,
276
+ colors : true
277
+ } )
278
+ )
275
279
if ( args . debug ) {
276
280
// Do not launch electron and provide instructions on launching through debugger
277
281
console . log (
278
282
'Not launching electron as debug argument was passed. You must launch electron though your debugger.'
279
283
)
280
284
console . log (
281
- `Make sure to set the WEBPACK_DEV_SERVER_URL env variable to ${
282
- server . url
283
- }
284
- And IS_TEST to true`
285
+ `If you are using Spectron, make sure to set the IS_TEST env variable to true.`
285
286
)
286
287
console . log (
287
288
'Learn more about debugging the main process at https://github.com/nklayman/vue-cli-plugin-electron-builder#debugging.'
@@ -302,8 +303,6 @@ module.exports = (api, options) => {
302
303
stdio : 'inherit' ,
303
304
env : {
304
305
...process . env ,
305
- // Give the main process the url to the dev server
306
- WEBPACK_DEV_SERVER_URL : server . url ,
307
306
// Disable electron security warnings
308
307
ELECTRON_DISABLE_SECURITY_WARNINGS : true
309
308
}
0 commit comments