https://github.com/nashaofu/electron-dev-webpack-plugin
A webpack plugin for electron development
https://github.com/nashaofu/electron-dev-webpack-plugin
development electron webpack webpack-plugin
Last synced: about 1 month ago
JSON representation
A webpack plugin for electron development
- Host: GitHub
- URL: https://github.com/nashaofu/electron-dev-webpack-plugin
- Owner: nashaofu
- License: mit
- Created: 2018-02-14T01:56:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-07T03:48:07.000Z (almost 6 years ago)
- Last Synced: 2025-06-08T22:25:27.554Z (about 1 year ago)
- Topics: development, electron, webpack, webpack-plugin
- Language: TypeScript
- Size: 246 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-dev-webpack-plugin
A webpack plugin for electron development, When the file changes automatically restart electron main process. example: [shortcut-capture](https://github.com/nashaofu/shortcut-capture/blob/master/build/main/webpack.dev.conf.js#L14)

## Install
[](https://nodei.co/npm/electron-dev-webpack-plugin/)
## Usage
```ts
import path from 'path'
import webpack, { Configuration } from 'webpack'
import ElectronDevWebpackPlugin from './src'
const config: Configuration = {
mode: 'development',
entry: {
app: './app.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
filename: '[name].js'
},
watch: true,
devtool: false,
plugins: [
new ElectronDevWebpackPlugin()
// or
new ElectronDevWebpackPlugin({
port: 5858 // electron inspect port
})
]
}
webpack(config, (err, stats) => {
console.log(err)
})
```
## Options
```ts
interface Options {
port?: number
title?: string
info?: (data: string) => void
warn?: (data: string) => void
}
```
- port: electron inspect port, default `5858`
```js
new ElectronDevWebpackPlugin({
port: 5858 // electron inspect port
})
```
- title: Plugin log title, default `MAIN PROCESS`
```js
new ElectronDevWebpackPlugin({
title: 'MAIN PROCESS'
})
```
- info: Functions for custom output logs
```js
new ElectronDevWebpackPlugin({
info: data => console.log(`INFO ${data}`)
})
```
- warn: Custom function to output warnings
```js
new ElectronDevWebpackPlugin({
warn: data => console.warn(`WARN ${data}`)
})
```