Webpack Sandbox External Plugin
This webpack plugin treats modules as externals in a way that doesn't cause errors when their required in an Electron sandbox.
It is heavily based on webpack's internal Webpack plugin.
Instead of outputting code like:
moduleexports = ;
It outputs code like this for externals:
if !processsandboxed moduleexports = ;
Install
yarn add -D webpack-sandbox-external-plugin
Usage
Add the plugin to your webpack
config. For example:
const SandboxExternalPlugin = ; moduleexports = plugins: 'commonjs' // output type 'sqlite3' 'keytar' // modules to externalize ;
⚠️ Only works for commonjs outputs, currently.