Registry / devops / electron-webpack

electron-webpack

JSON →
library2.8.2jsnpmunverified

electron-webpack simplifies webpack configuration for Electron apps, providing a pre-configured setup for main and renderer processes with HMR, Babel, and CSS support. Current stable version is 2.8.2 (latest release March 2021). It is a mature project with periodic bug fixes; development appears to have slowed but it remains functional for webpack 4. Key differentiators: updates via a single module instead of boilerplate, automatic Babel config based on Electron version, and add-on system for TypeScript, Less, etc. Note: it does not support webpack 5, and the project is in maintenance mode.

npm install electron-webpack
INSTALL
IMPORT
SIG · ELECTRON-WEBPACK
E
electron-webpack
devopsjavascriptv2.8.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

electron-webpack
import electronWebpack from 'electron-webpack'
const electronWebpack = require('electron-webpack')
ESM vs CJS: electron-webpack ships both ESM and CJS, but the recommended usage is via CLI or config, not direct import of the main module.

Shows minimal package.json scripts to run dev and build commands using electron-webpack CLI.

{ "scripts": { "dev": "electron-webpack dev", "build": "electron-webpack build" }, "devDependencies": { "electron-webpack": "^2.8.2", "webpack": "^4.42.1", "electron": "^18.0.0" } } // Ensure package.json has main and renderer entries as per docs. // Run: yarn install && yarn dev
electron-webpack --version
Debug
Known issues
gotchaelectron-webpack is designed for webpack 4 and does not support webpack 5. Upgrading webpack to 5 will break builds.
fix
Keep webpack at version ^4.42.1 or consider migrating to electron-forge or other webpack 5 solutions.
affects: >=2.0.0
deprecatedThe project is in maintenance mode with no recent major updates. New Electron features may not be supported.
fix
Evaluate alternative tools like electron-forge with webpack plugin or custom webpack config.
affects: >=2.0.0
gotchaBabel configuration is auto-derived from Electron version; custom .babelrc may conflict.
fix
Avoid custom Babel config; use electron-webpack's 'babel' option in package.json if needed.
affects: >=2.0.0
gotchaCSS Modules require specific file naming convention (e.g., *.module.css) to be enabled.
fix
Name CSS files with *.module.css extension to use CSS Modules.
affects: >=2.7.2
gotchaNode.js >=10 required; older versions may produce errors.
fix
Use Node.js 10 or later.
affects: >=2.8.0
Errors
Common errors & fixes
Error: Cannot find module 'webpack'
Missing webpack as a dependency; electron-webpack requires webpack as a peer dependency.
fix
Run: npm install webpack@^4.42.1 --save-dev
Error: The 'main' field in package.json must point to a valid entry file for Electron
electron-webpack expects specific directory structure (src/main/index.js) or custom config.
fix
Ensure you have src/main/index.js or configure entry in package.json under 'electronWebpack'.
Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type.
Missing webpack loader for the file type (e.g., .vue, .ts) without adding appropriate add-on package.
fix
Install and configure add-on like electron-webpack-vue or electron-webpack-ts.
Upgrade
Version history
2.8.2latest on npm
Audit
Dependencies
webpackrequiredPeer dependency: electron-webpack uses webpack 4.x for bundling.
Agent activity
4 hits · last 30 days
node
4
Resources
electron-webpack — npm install electron-webpack · libregistry