You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Quick Start
3
3
sidebarDepth: 2
4
4
---
5
5
6
-
##Quick Start
6
+
# Quick Start
7
7
8
8
::: warning Important
9
9
Your app must be created with Vue-CLI 3 (vue create my-app), will not work with Vue-CLI 2 (vue init webpack my-app)!
@@ -13,7 +13,7 @@ Your app must be created with Vue-CLI 3 (vue create my-app), will not work with
13
13
These docs are for the v1.0.0-beta release of VCP Electron Builder. If you were previously using an older version of vue-cli-plugin-electron-builder (<1.0.0), please see the [upgrade guide](./upgrading.md) or [view the old docs](https://github.com/nklayman/vue-cli-plugin-electron-builder/tree/legacy).
14
14
:::
15
15
16
-
###Installation
16
+
## Installation
17
17
18
18
Open a terminal in the directory of your app created with Vue-CLI 3.
19
19
@@ -23,7 +23,7 @@ Then, install and invoke the generator of vue-cli-plugin-electron-builder by run
23
23
24
24
That's It! You're ready to go!
25
25
26
-
###To start a development server
26
+
## To start a development server
27
27
28
28
If you use [Yarn](https://yarnpkg.com/en/) (strongly recommended):
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+42-42Lines changed: 42 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
sidebarDepth: 2
3
3
---
4
4
5
-
##Configuration
5
+
# Configuration
6
6
7
-
###Configuring Electron Builder
7
+
## Configuring Electron Builder
8
8
9
9
To see available options, check out [Electron Builder Configuration Options](https://www.electron.build/configuration/configuration)
10
10
@@ -14,21 +14,21 @@ They can be placed under the `builderOptions` key in vue-cli-plugin-electron-bui
14
14
// vue.config.js
15
15
16
16
module.exports= {
17
-
pluginOptions: {
18
-
electronBuilder: {
19
-
builderOptions: {
20
-
// options placed here will be merged with default configuration and passed to electron-builder
21
-
}
17
+
pluginOptions: {
18
+
electronBuilder: {
19
+
builderOptions: {
20
+
// options placed here will be merged with default configuration and passed to electron-builder
21
+
}
22
+
}
22
23
}
23
-
}
24
24
}
25
25
```
26
26
27
27
:::tip
28
28
All CLI arguments passed to `build:electron` will be forwarded to electron-builder.
29
29
:::
30
30
31
-
###Webpack configuration
31
+
## Webpack configuration
32
32
33
33
Your regular config is used for bundling the renderer process (your app). To modify the webpack config for the electron main process only, use the `chainWebpackMainProcess` function under vue-cli-plugin-electron-builder's plugin options in `vue.config.js`. Use `chainWebpackRendererProcess` customize your app's webpack config for Electron builds only. To learn more about webpack chaining, see [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain). The function should take a config argument, modify it through webpack-chain, and then return it.
34
34
@@ -38,32 +38,32 @@ Your regular config is used for bundling the renderer process (your app). To mod
38
38
// vue.config.js
39
39
40
40
module.exports= {
41
-
configureWebpack: {
42
-
// Configuration applied to all builds
43
-
},
44
-
pluginOptions: {
45
-
electronBuilder: {
46
-
chainWebpackMainProcess:config=> {
47
-
// Chain webpack config for electron main process only
48
-
},
49
-
chainWebpackRendererProcess:config=> {
50
-
// Chain webpack config for electron renderer process only
51
-
// The following example will set IS_ELECTRON to true in your app
52
-
config.plugin('define').tap(args=> {
53
-
args[0]['IS_ELECTRON'] =true
54
-
return args
55
-
})
56
-
// If you do not return the config property, your app may break!
57
-
return config
58
-
},
59
-
// Use this to change the entrypoint of your app's main process
60
-
mainProcessFile:'src/myBackgroundFile.js'
41
+
configureWebpack: {
42
+
// Configuration applied to all builds
43
+
},
44
+
pluginOptions: {
45
+
electronBuilder: {
46
+
chainWebpackMainProcess:config=> {
47
+
// Chain webpack config for electron main process only
48
+
},
49
+
chainWebpackRendererProcess:config=> {
50
+
// Chain webpack config for electron renderer process only
51
+
// The following example will set IS_ELECTRON to true in your app
52
+
config.plugin('define').tap(args=> {
53
+
args[0]['IS_ELECTRON'] =true
54
+
return args
55
+
})
56
+
// If you do not return the config property, your app may break!
57
+
return config
58
+
},
59
+
// Use this to change the entrypoint of your app's main process
60
+
mainProcessFile:'src/myBackgroundFile.js'
61
+
}
61
62
}
62
-
}
63
63
}
64
64
```
65
65
66
-
###Changing the output directory
66
+
## Changing the output directory
67
67
68
68
If you don't want your files outputted into dist_electron, you can choose a custom folder in vue-cli-plugin-electron-builder's plugin options.
69
69
@@ -73,29 +73,29 @@ If you don't want your files outputted into dist_electron, you can choose a cust
73
73
// vue.config.js
74
74
75
75
module.exports= {
76
-
pluginOptions: {
77
-
electronBuilder: {
78
-
outputDir:'electron-builder-output-dir'
76
+
pluginOptions: {
77
+
electronBuilder: {
78
+
outputDir:'electron-builder-output-dir'
79
+
}
79
80
}
80
-
}
81
81
}
82
82
```
83
83
84
-
###TypeScript Options
84
+
## TypeScript Options
85
85
86
86
Typescript support is automatic and requires no configuration, just add the `@vue/typescript` cli plugin. There are a few options for configuring typescript if necessary:
87
87
88
88
```javascript
89
89
// vue.config.js
90
90
91
91
module.exports= {
92
-
pluginOptions: {
93
-
electronBuilder: {
94
-
// option: default // description
95
-
disableMainProcessTypescript:false, // Manually disable typescript plugin for main process. Enable if you want to use regular js for the main process (src/background.js by default).
96
-
mainProcessTypeChecking:false// Manually enable type checking during webpck bundling for background file.
92
+
pluginOptions: {
93
+
electronBuilder: {
94
+
// option: default // description
95
+
disableMainProcessTypescript:false, // Manually disable typescript plugin for main process. Enable if you want to use regular js for the main process (src/background.js by default).
96
+
mainProcessTypeChecking:false// Manually enable type checking during webpck bundling for background file.
Copy file name to clipboardExpand all lines: docs/guide/guide.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,24 @@
2
2
sidebarDepth: 2
3
3
---
4
4
5
-
##Guide
5
+
# Guide
6
6
7
-
###Handling static assets
7
+
## Handling static assets
8
8
9
-
####Renderer process (main app)
9
+
### Renderer process (main app)
10
10
11
11
In the renderer process, static assets work similarly to a regular app. Read Vue CLI's documentation [here](https://cli.vuejs.org/guide/html-and-static-assets.html) before continuing. However, there are a few changes made:
12
12
13
-
- The `__static` global variable is added. It provides a path to your public directory in both development and production. Use this to read/write files in your app's public directory.
14
-
- In production, the `process.env.BASE_URL` is replaced with the path to your app's files.
13
+
-The `__static` global variable is added. It provides a path to your public directory in both development and production. Use this to read/write files in your app's public directory.
14
+
-In production, the `process.env.BASE_URL` is replaced with the path to your app's files.
15
15
16
16
**Note: `__static` is not available in regular build/serve. It should only be used in electron to read/write files on disk. To import a file (img, script, etc...) and not have it be transpiled by webpack, use the `process.env.BASE_URL` instead.**
17
17
18
-
####Main process (background.js)
18
+
### Main process (background.js)
19
19
20
20
The main process won't have access to `process.env.BASE_URL` or `src/assets`. However, you can still use `__static` to get a path to your public directory in development and production.
21
21
22
-
####Examples:
22
+
### Examples:
23
23
24
24
```vue
25
25
<!-- Renderer process only -->
@@ -43,7 +43,7 @@ console.log(fileContents)
43
43
</script>
44
44
```
45
45
46
-
###Folder Structure
46
+
## Folder Structure
47
47
48
48
```
49
49
├── dist_electron/
@@ -61,24 +61,24 @@ console.log(fileContents)
61
61
├── ...
62
62
```
63
63
64
-
###How it works
64
+
## How it works
65
65
66
-
####Build command
66
+
### Build command
67
67
68
68
The build command consists of three main phases: render build, main build, and electron-builder build:
69
69
70
70
1. Render build: This phase calls `vue-cli-service build` with some custom configuration so it works properly with electron. (The render process is your standard app.)
71
71
2. Main build: This phase is where vue-cli-plugin-electron-builder bundles your background file for the main process (`src/background.js`).
72
72
3. Electron-builder build: This phase uses [electron-builder](https://www.electron.build) to turn your web app code into an desktop app powered by [Electron](https://electronjs.org).
73
73
74
-
####Serve command
74
+
### Serve command
75
75
76
76
The serve command also consists of 3 main phases: main build, dev server launch, and electron launch:
77
77
78
78
1. Dev server launch: This phase starts the built in dev server with a few modifications to work properly with electron.
79
79
2. Main build: This phase, like in the build command, bundles your app's main process, but in development mode.
80
80
3. Electron launch: This phase launches electron and tells it to load the url of the above dev server.
81
81
82
-
###Is this plugin production ready?
82
+
## Is this plugin production ready?
83
83
84
84
This plugin is nearly production ready. It has test coverage for everything but the UI interface and proper logging of errors. It needs to be used a little bit more in large applications before it is considered safe to use in a large production environment. Please try it in your app and report any bugs or feature requests.
Copy file name to clipboardExpand all lines: docs/guide/testingAndDebugging.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,23 @@
2
2
sidebarDepth: 2
3
3
---
4
4
5
-
##Testing and Debugging
5
+
# Testing and Debugging
6
6
7
-
###Debugging
7
+
## Debugging
8
8
9
-
####Renderer Process (Main App)
9
+
### Renderer Process (Main App)
10
10
11
11
You can debug the renderer process using [Vue Devtools](https://github.com/vuejs/vue-devtools). Vue Devtools are automatically installed for you (powered by [electron-devtools-installer](https://github.com/MarshallOfSound/electron-devtools-installer)).
12
12
13
-
####Main Process (Background File)
13
+
### Main Process (Background File)
14
14
15
15
First, read [Electron's instructions](https://electronjs.org/docs/tutorial/debugging-main-process#command-line-switches) for debugging the main process. Before launching Electron through your debugger, run `serve:electron` in debug mode with the `--debug` argument. This will prevent Electron from launching automatically and enable source map support. Make sure to set the background file `dist_electron/background.js`.
16
16
17
17
::: tip
18
18
If you are testing with spectron, make sure to set `process.env.IS_TEST` to `true`. This will prevent dev tools from being loaded which results in errors.
19
19
:::
20
20
21
-
###Testing
21
+
## Testing
22
22
23
23
:::tip
24
24
If you don't want to use Spectron, you can still use this function, just set `noSpectron` to `true`
@@ -34,15 +34,15 @@ vue-cli-plugin-electron-builder exports a `testWithSpectron` function. This func
0 commit comments