- b033bc5 v0.11.2
- 8190208 docs: typo
- 111d495 refactor(π¨): better build logic
- 76611a9 fix: disable
browserField
by default #136 - 241534f feat: add
.npmrc
forpnpm
- 65d4ab1 chore: bump deps
- b4308e3 chore: rename
- 036e52c docs: update
- a222c48 examples: update quick-start
- d04155c examples: add javascript-api
- 9213ba0 docs: update
- 9b8da83 fix: cannot find type definition #126
- e864b81 examples: update multiple-window, add multiple-renderer
- 0a226b5 docs: update
- ff5e9dc feat: add logo.svg
- 7cec6ad examples: add multiple-windows
- f8528ed Merge pull request #123 from xhayper/patch-1
- 1e9f9b0 feat: remove extra dependencies
- 8fa6ce4 feat: update package and example
- 1d7eca5 feat: add test π±
- 9ef3e8e chore: bump deps
- 56446e2 chore: cleanup
- 2bf7d0b docs:
startup()
- 401a44e refactor: cleanup
// 0.10.0
function build(config: Configuration | Configuration[]): Promise<void>
// 0.11.0 - Same as Vite's build
function build(config: Configuration): Promise<RollupOutput | RollupOutput[] | RollupWatcher>
JavaScript API
vite-plugin-electron
's JavaScript APIs are fully typed, and it's recommended to use TypeScript or enable JS type checking in VS Code to leverage the intellisense and validation.
Configuration
- typedefineConfig
- functionresolveViteConfig
- function, Resolve the default Vite'sInlineConfig
for build Electron-MainwithExternalBuiltins
- functionbuild
- functionstartup
- function
Example:
build(
withExternalBuiltins( // external Node.js builtin modules
resolveViteConfig( // with default config
{
entry: 'foo.ts',
vite: {
mode: 'foo-mode', // for .env file
plugins: [{
name: 'plugin-build-done',
closeBundle() {
// Startup Electron App
startup()
},
}],
},
}
)
)
)
V8 Bytecode support π bytecode
Inspired by:
- Support Vite4.x | #118, 28d38b6
- Bytecode example | df170c2
- JavaScript API docs | 3049169
- Fix load
.env
| 758695d - Refactor
build()
| d9c3343
- e4f943f refactor: move
build.resolve
toresolve
- 91fb525 docs(zh-CN): update | @ggdream
- 41db615 Use mode from source config. | #105, #106
- 0b24909 refactor: cleanup, provides some programmable APIs π±
- 58517d8 refactor(proj-struct): remove
vite-plugin-electron-renderer
- d2b3c29 Merge pull request #98 from skyrpex/patch-1
- 1645be2 fix: ignore the browser field when bundling
By default, the dist
folder will be automatically removed by Vite. We build Electron related files into dist-electron
to prevent it from being removed by mistake
- Remove Vite
3.2.0
| #90 - ad9bb3c refactor(electron-renderer)!: remove
options.resolve()
, use 'lib-esm' for resolve Node.js modules andelectron
| vite-plugin-electron-renderer - b500039 feat(electron-renderer): support
optimizeDeps
for Electron-Renderer π - f28e66b faet(outDir)!:
dist/electron
->dist-electron
| vite-plugin-electron
- 59a24df fix(electron-renderer): use
createRequire()
instead ofimport()
π - 11cd4c3 feat(electron):
onstart
providesreload()
This is a redesigned version of the API(Only 3 APIs). Not compatible with previous versions!
export type Configuration = {
/**
* Shortcut of `build.lib.entry`
*/
entry?: import('vite').LibraryOptions['entry']
/**
* Triggered when Vite is built.
* If passed this parameter will not automatically start Electron App.
* You can start Electron App through the `startup` function passed through the callback function.
*/
onstart?: (this: import('rollup').PluginContext, startup: (args?: string[]) => Promise<void>) => void
vite?: import('vite').InlineConfig
}
In the past few weeks, some issues have been mentioned in many issues that cannot be solved amicably. So I refactored the API to avoid design flaws. But despite this, the new version will only be easier rather than harder.
For example, some common problems in the following issues.
Thanks to [email protected]'s lib.entry
supports multiple entries, which makes the configuration of the new version very simple. So the [email protected]
requires Vite at least v3.2.0
.
e.g.
import electron from 'vite-plugin-electron'
// In plugins option
electron({
entry: [
'electron/entry-1.ts',
'electron/entry-2.ts',
],
})
// Or use configuration array
electron([
{
entry: [
'electron/entry-1.ts',
'electron/entry-2.ts',
],
},
{
entry: 'foo/bar.ts',
},
])
vite-plugin-electron-renderer
will change output.format
to cjs
format by default(This is because currently Electron@21 only supports CommonJs), which will cause the built code to use require
to import modules, if the user nodeIntegration
is not enabled in the Electron-Main process which causes the error require is not defined
to be thrown.
[email protected]
provides the nodeIntegration
option. It is up to the user to decide whether to use Node.js(CommonJs).
e.g.
import renderer from 'vite-plugin-electron-renderer'
// In plugins option
renderer({
nodeIntegration: true,
})
You can see π examples/worker
-
Use Worker in Electron-Main
e.g. This looks the same as multiple entry
import electron from 'vite-plugin-electron' // In plugins option electron({ entry: [ 'electron/main.ts', 'electron/worker.ts', ], }) // In electron/main.ts new Worker(path.join(__dirname, './worker.js'))
-
Use Worker in Electron-Renderer
e.g.
import renderer, { worker } from 'vite-plugin-electron-renderer' export default { plugins: [ renderer({ // If you need use Node.js in Electron-Renderer process nodeIntegration: true, }), ], worker: { plugins: [ worker({ // If you need use Node.js in Worker nodeIntegrationInWorker: true, }), ], }, }
- There is no way to differentiate between Preload-Scripts, which will cause the entire Electron App to restart after the preload update, not the Electron-Renderer reload.
vite-plugin-electron
vite-plugin-electron-renderer
- 191afb8 feat: proxy
ipcRenderer
inWorker
| #69
vite-plugin-electron
- 715a1cd fix(electron):
VITE_DEV_SERVER_HOSTNAME
insteadVITE_DEV_SERVER_HOST
vite-plugin-electron-renderer
vite-plugin-electron
- db61e49 feat(electron): support custom start π± | #57, #58
vite-plugin-electron-renderer
π v0.9.0
is a stable version based on [email protected]
vite-plugin-electron
vite-plugin-electron-renderer
- ebc6a3d chore(electron-renderer): remove
renderBuiltUrl()
based on [email protected] ([email protected])
sync vite-plugin-electron-renderer
version
70a8c6e fix: electron-vite/electron-vite-vue#229
ESM -> CJS
PR: #51
-
feat: add
VITE_DEV_SERVER_URL
to electron process env, so that it is easier to use -
fix(π): VITE_DEV_SERVER_HOSTNAME cannot be used directly when VITE_DEV_SERVER_HOSTNAME is a ipv6 address or vite config
server.host
is true -
fix(π): use vite config
mode
as default build mode to avoid build mode not equal to vite configmode
when vite configmode
!== 'development' which would lead to render env not equal to electron main or preload -
fix(π): build electron output after render to avoid the electron output being deleted when the vite config emptyOutDir is
true
and the vite command isbuild
-
fix(π): use
closeBundle
to replacewriteBundle
, because in extreme cases, an error will be reported. For example,can't find preload module
will occur as an error whenpreload
update frequently
- π± c8b59ba Support
envFile
options electron-vite-vue/issues/209 - π± 2d7f033 Add
ImportMeta['env']
declaration - π± 20d0a22 Must use
pnpm publish
instead ofnpm publish
#43
- 9ee720f chore(electron): remove
envFile: false
- 0016d52 fix(π):
normalizePath()
- 33b121a chore(deps): hoist
typescript
- d3bd37a chore(electron): change import path
- 45f34d9 [email protected]
- daa1c52 docs:
[email protected]
- e4e7ee0 chore: fix link
- d1d4c82 chroe: bump deps
- 581ef71 chore(deps): bump vite to 3.0.2
- 481368a chore: remove unused def
- 71d54c1 chore(π): update import path
- 3bae8e5 refactor:
checkPkgMain.buildElectronMainPlugin()
- dba119d chore: format code
- 739e659 feat: use
checkPkgMain()
- 192a8ca refactor: standlone
checkPkgMain
function - aaa9030 chore: explicitly specify external modules
- 3eac722 chore: remove TODO
- c03abe9 feat: add
checkPkgMain()
plugin - d8c0f8e chore: rename param
- 04c94dd feat:
checkPkgMain()
- 7b9631a deps: add
rollup
- cec6db6 deps(π): add rollup for import
InputOption
- a4de86e monorepo: move
vite-plugin-electron
topackages/electron
- 1ed6e19 chore: bump vite-plugin-electron-renderer to v0.5.7
- c60fb17 chore: update params
- 13f0c70 chore: bump vite-plugin-electron-renderer to 0.5.6
- 2033256 chore: bump deps
- 8fb064e fix(π): bump vite-plugin-electron-renderer to 0.5.3
- 44006b2 chore: comments
- 42acf37 docs: update
- 6d878f7 refactor: use
resolveModules()
- acf1751 chore: bump deps
- 661a146 docs: v0.7.0
- 8ee091d feat: support restart on
vite.config.ts
changed #24 - ca15795 add
electron-env.d.ts
- 76863bb electron-env.d.ts
- 3fbef04 refactor: optimize code
- cc3c8c0 feat:
resolveBuildConfig()
- 50c3afe feat:
resolveRuntime()
- 1184dd3
node.js.ts
->config.ts
- 5779397 chore: bump vite-plugin-electron-renderer to 0.5.1
- 2a2f77d docs:
Put Node.js packages in dependencies
- 5b736fa bump vite-plugin-electron-renderer to 0.5.0
- f70e030 fix(π): ensure always load into
buildConfig()
- 73ae8f2 docs: update
- 5204eca docs: v0.6.0
- e885e54 feat:
withExternal()
- dee6d6a feat:
CommonConfiguration
- 55f9e11 node.js.ts
- 83d0b8d remove README.zh-CN.md
- 5f488b8 remove
polyfille-exports
- e118fbd remove
renderer
- 6e5761f refactor: integrate
vite-plugin-electron-renderer
- 0e696ec add
vite-plugin-electron-renderer
- 87bc5bb remove
vite-plugin-optimizer
- 0c5155c chore: TODO
- 892940e fix app,getName() return error name
- abf460f chore: variable rename
- ceb559f chore:
build.cssCodeSplit=false
- ab40088 fix(π): set
emptyOutDir=false
for prevent accidental deletion of files - 7baafa0 break: set
electron
build.outDir
value isdist/electron
by default - c13eb49 fix(π): assign default value
dist/electron/[process]
ofbuild.outDir
electron-vite#10
- 1346707 refactor: better assign default
build.outDir
- f489da1 chore: commnets
- 6db3bf3 fix: check
output
is Array
- 394cf6f feat:
config.build.emptyOutDir = false
by default - 4a67688 feat(π): enabled
polyfill-exports
by default