npm.io
1.0.4 • Published 8 years ago

webpack-electron-connect-plugin

Licence
MIT
Version
1.0.4
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
2

webpack-electron-connect-plugin

webpack plugin to reload and restart Electron

requires electron-connect package

Installation

npm install --save-dev electron-connect webpack-electron-connect-plugin

or

yarn add --dev electron-connect webpack-electron-connect-plugin

Usage

Electron renderer process

<html>
<body>

<!-- add script -->
<script>require('electron-connect').client.create()</script>

</body>
</html>

webpack.config

const ElectronConnectPlugin = require("webpack-electron-connect-plugin");

{
    // ...
    plugins: [
        new ElectronConnectPlugin({
            type: "reload", // "reload" or "restart"
            options: {}
        })
    ];
}

use webpack watch option

webpack -w

API

type
// Not kill Electron process. reload Electron
{
    type: "reload",
}

// Kill Electron process. restart Electron
{
    type: "restart",
}
options

check server.create([options]) from npm electron-connect page

// example
{
    options: {
        port: 30080, // WebSocket server port (default: 30080)
    }
}

License

MIT

Keywords