Skip to content

Commit 2791bae

Browse files
committed
serve now uses target of electron-renderer instead of default
1 parent 83b6057 commit 2791bae

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ The build command consists of three main phases: render build, main build, and e
142142
The serve command also consists of 3 main phases: main build, dev server launch, and electron launch:
143143

144144
1. Main build: This phase, like in the build command, bundles your app's main process, but in development mode.
145-
2. Dev server launch: This phase starts the built in dev server with no special arguments, just hosting your app as normal.
145+
2. Dev server launch: This phase starts the built in dev server with a few modifications to work properly with electron.
146146
3. Electron launch: This phase launches electron and tells it to load the url of the above dev server.

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ module.exports = (api, options) => {
145145
},
146146
() => {
147147
const execa = require('execa')
148+
const serve = require('@vue/cli-service/lib/commands/serve').serve
149+
const rendererConfig = api.resolveChainableWebpackConfig()
150+
rendererConfig.target('electron-renderer')
148151
const mainConfig = new Config()
149152
mainConfig
150153
.mode('development')
@@ -203,7 +206,7 @@ module.exports = (api, options) => {
203206

204207
console.log('\nStarting development server:\n')
205208

206-
api.service.run('serve').then(server => {
209+
serve({ _: [] }, api, options, rendererConfig).then(server => {
207210
console.log('\nLaunching Electron...\n')
208211
const child = execa(
209212
`./node_modules/.bin/electron ${outputDir}/background.js`,

vue-cli-service-v3.0.0-rc.2.tgz

-17 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)