electron-esbuild
Easily integrate esbuild for your Electron environment.
Features
- Use of
esbuild
for main source code building - Use of
webpack
for renderer source code building - HMR for
renderer
and main
processes - Full control of your webpack configuration
- Full control of your esbuild configuration
- Use electron-builder for final package
Use
npm i -D electron-esbuild
Start a development build (example)
npx electron-esbuild dev
Create a build (example)
npx electron-esbuild build
npx electron-esbuild build --no-clean # do not clean output before build
Package the app (example)
npx electron-builder -p=never
Quick start
You can use this example for a starter React with TypeScript
Configuration
Create a electron-esbuild configuration electron-esbuild.config.yaml
esbuildMainConfig: esbuild.config.js
webpackRendererConfig: webpack.config.js
Main esbuild config
See example
const path = require('path')
module.exports = (merge) => {
const isProduction = process.env.NODE_ENV === 'production'
return {
platform: 'node',
entryPoints: [path.resolve('src/main/main.ts')],
bundle: true,
target: 'node12.18.4',
loader: {
'.ts': 'ts',
},
sourcemap: false,
define: {
'process.env.NODE_ENV': `'${process.env.NODE_ENV}'`,
},
...merge,
}
}
Renderer webpack configuration
See example
This example use HMR/Hot reload in the renderer process in development!