Releases: nklayman/vue-cli-plugin-electron-builder
V3 Alpha!
I'm happy to announce the first alpha of v3 is here! This release mainly updates all dependencies and cleans up some legacy code. There are no docs yet and this hasn't been tested thoroughly so be careful when using this in production. Please give me feedback and issue reports so I can promote this to stable ASAP.
Key Features/Fixes
- Latest Electron versions are now supported in the generator
- Spectron is dropped in favor of Playwright which should provide a much better testing experience
- Webpack 5 is now used for the main process
- New native dependency checker is enabled by default (#861)
- A more secure custom protocol implementation is used that prevents path traversal (thanks to https://github.com/moloch--/reasonably-secure-electron for code)
Upgrading/Breaking Changes
- Install this version with
vue add electron-builder@alpha
- Using Vue CLI v5 is recommended
- Remove the
main
field from yourpackage.json
- Make sure your custom main process webpack config works with webpack v5
background.js
shouldn't require any changes, but you can remove theenableRemoteModule
setting for Spectron if it's there- Migrate from Spectron to Playwright:
testWithSpectron
has been renamed totestWithPlaywright
, and doesn't take the Spectron import as an arg. The returnedapp
is now a Playwright ElectronApplication instead of a Spectron instance, andstopServe
has been renamed tostop
. You don't need to install Playwright, it's a dependency of this plugin. - In theory, everything else should continue to work as before, open an issue if it doesn't
TODO
- Support Mocha for testing (only Jest is supported for now)
- Update internal testing
- Update docs
V 2.0.0!!!!
This release has been long overdue and this plugin has been in the RC state for way too long, sorry for the delay. Anyways, better late than never, so here it is! If you were running the latest RC previously, there aren't any breaking changes or required migration steps. Thank you to all my supporters who have funded this project and made this release possible ❤️❤️!!
Breaking Changes from v1.x
- The
testWithSpectron
function requires you pass thespectron
module as it's first arg, allowing you to specify the version of spectron to be used. You will need to install spectron as adevDependency
- Jest tests must be run with
testEnvironment
set tonode
, see the examples for more details - Node integration is disabled by default
- Electron devtools installer should be used over the
installVueDevtools
function
A few major deps were upgraded:
- teser-webpack-plugin ^1.1.0 -> ^2.0.0
- webpack-chain ^5.0.0 -> ^6.0.0
- execa: ^1.0.0 -> ^4.0.0
- electron-builder: ^21.2.0 -> 22.2.0
These upgrades may cause breaking changes depending on your specific application.
The internal tests are now run on vue cli v4, and it is recommended that you update your app to vue cli v4 as well.
Fixes and Features
- Support latest electron versions
- nodeIntegration is now optional (and disabled by default), #610
- electron-builder will now work on macos catalina, #617
- You can now use the proper spectron version, #467
- Removed fonts duplication in build, #694
- You can now bundle preload files with webpack (docs), #613
- New native dep checker, try it out now! (#861)
- Vue devtools enabled by default on Electron v8/9 (#378)
- Support
package.json
withoutdependencies
field (#828) - Support
electron
being listed independencies
as well asdevDependencies
(#829) - Support nested pages (#786)
- And a lot more smaller fixes
Migrating a v1.x Project:
- Run
(yarn add | npm install) -D vue-cli-plugin-electron-builder@latest
to install the 2.0 version of the plugin. - In your
background.(js|ts)
, replacenodeIntegration:true
with:
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
- If your app requires
nodeIntegration
, enable it invue.config.js
:
module.exports = {
pluginOptions: {
electronBuilder: {
nodeIntegration: true
}
}
}
- If you used the
testWithSpectron
function, install the proper version of spectron according to the version map, and pass the spectron import at the first argument of all of yourtestWithSpectron
calls. See the docs for more details. - If you used jest, set the test environment to node in each electron test file. See the docs for more details.
- Update your main process file (
src/background.js
by default) to use electron-devtools-installer:
import {
createProtocol,
- installVueDevtools
} from 'vue-cli-plugin-electron-builder/lib'
+ import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
... (around line 77)
-await installVueDevtools()
+await installExtension(VUEJS_DEVTOOLS)
And then run npm i -D electron-devtools-installer
/yarn add -D electron-devtools-installer
.
After following these steps, your project should be good to go with v2.0!
v2.0.0-rc.4 - Switch to electron-devtools-installer
From now on, whenever you add this plugin to your project, electron-devtools-installer will be used instead of the provided installVueDevtools
function. This function was based off of electron-devtools-installer but with some fixes. These fixes have since been merged into electron-devtools-installer (as well as new features like electron v9 support). It is recommended that you switch to electron-devtools-installer as the installVueDevtools
function will be removed in the 2.0.0
final release. To do so, edit your background.(js|ts)
:
import {
createProtocol,
- installVueDevtools
} from 'vue-cli-plugin-electron-builder/lib'
+ import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
... (around line 77)
-await installVueDevtools()
+await installExtension(VUEJS_DEVTOOLS)
And then run npm i -D electron-devtools-installer
/yarn add -D electron-devtools-installer
.
v2.0.0-rc.3 - New native dep checker
v2.0.0-rc.2
2.0 Release Candidate!
Breaking Changes
- The
testWithSpectron
function requires you pass thespectron
module as it's first arg, allowing you to specify the version of spectron to be used. You will need to install spectron as adevDependency
- Jest tests must be run with
testEnvironment
set tonode
, see the examples for more details - Node integration is disabled by default
A few major deps were upgraded:
- teser-webpack-plugin ^1.1.0 -> ^2.0.0
- webpack-chain ^5.0.0 -> ^6.0.0
- execa: ^1.0.0 -> ^4.0.0
- electron-builder: ^21.2.0 -> 22.2.0
These upgrades may cause breaking changes depending on your specific application.
The internal tests are now run on vue cli v4, and it is recommended that you update your app to vue cli v4 as well.
Fixes and Features
- Support electron v7 (+ v8 and v9), #555
- nodeIntegration is now optional (and disabled by default), #610
- electron-builder will now work on macos catalina, #617
- You can now use the proper spectron version, #467
- Removed fonts duplication in build, #694
- You can now bundle preload files with webpack (docs), #613
Migrating a v1.x Project:
- Run
(yarn add | npm install) -D vue-cli-plugin-electron-builder@latest
to install the 2.0 version of the plugin. - In your
background.(js|ts)
, replacenodeIntegration:true
with:
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
- If your app requires
nodeIntegration
, enable it invue.config.js
:
module.exports = {
pluginOptions: {
electronBuilder: {
nodeIntegration: true
}
}
}
- If you used the
testWithSpectron
function, install the proper version of spectron according to the version map, and pass the spectron import at the first argument of all of yourtestWithSpectron
calls. See the docs for more details. - If you used jest, set the test environment to node in each electron test file. See the docs for more details.
v2.0.0 Beta - new deps, spectron fixes, disabling nodeIntegration
Breaking changes
- The
testWithSpectron
function requires you pass thespectron
module as it's first arg, allowing you to specify the version of spectron to be used. You will need to install spectron as adevDependency
- Jest tests must be run with
testEnvironment
set tonode
, see the examples for more details - Node integration is disabled by default
A few major deps were upgraded:
teser-webpack-plugin ^1.1.0 -> ^2.0.0
webpack-chain ^5.0.0 -> ^6.0.0
execa: ^1.0.0 -> ^3.0.0
electron-builder: ^21.2.0 -> 22.2.0
These upgrades may cause breaking changes depending on your specific application.
The internal tests are now run on vue cli v4, and it is recommended that you update your app to vue cli v4 as well.
Fixes and Features
- Support electron v7, #555
- nodeIntegration is now optional, #610
- electron-builder will now work on macos catalina, #617
- You can now use the proper spectron version, #467
- Removed fonts duplication in build, #694
Known Issues
- #647: stopServe() in testWithSpectron() may throw
setTimeout(...).unref is not a function
Migrating a v1.x project:
- In your
background.(js|ts)
, replacenodeIntegration:true
with:
// Use pluginOptions.nodeIntegration, leave this alone
// See https://github.com/nklayman/vue-cli-plugin-electron-builder/blob/v2/docs/guide/configuration.md#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
- If your app requires
nodeIntegration
, enable it invue.config.js
:
module.exports = {
pluginOptions: {
electronBuilder: {
nodeIntegration: true
}
}
}
- If you used the
testWithSpectron
function, install the proper version of spectron according to the version map, and pass the spectron import at the first argument of all of yourtestWithSpectron
calls. See the docs for more details. - If you used jest, set the test environment to node in each electron test file. See the docs for more details.
1.4.0 - Electron 6 support
This release adds support for electron 6.0.0. However, there are issues with devtools extensions, so vue devtools are disabled by default if electron v6.0.0 is selected.