{"id":19459,"library":"electron-webpack","title":"electron-webpack","description":"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.","status":"maintenance","version":"2.8.2","language":"javascript","source_language":"en","source_url":"https://github.com/electron-userland/electron-webpack","tags":["javascript","typescript"],"install":[{"cmd":"npm install electron-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add electron-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add electron-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: electron-webpack uses webpack 4.x for bundling.","package":"webpack","optional":false}],"imports":[{"note":"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.","wrong":"const electronWebpack = require('electron-webpack')","symbol":"electron-webpack","correct":"import electronWebpack from 'electron-webpack'"}],"quickstart":{"code":"{\n  \"scripts\": {\n    \"dev\": \"electron-webpack dev\",\n    \"build\": \"electron-webpack build\"\n  },\n  \"devDependencies\": {\n    \"electron-webpack\": \"^2.8.2\",\n    \"webpack\": \"^4.42.1\",\n    \"electron\": \"^18.0.0\"\n  }\n}\n// Ensure package.json has main and renderer entries as per docs.\n// Run: yarn install && yarn dev","lang":"typescript","description":"Shows minimal package.json scripts to run dev and build commands using electron-webpack CLI."},"warnings":[{"fix":"Keep webpack at version ^4.42.1 or consider migrating to electron-forge or other webpack 5 solutions.","message":"electron-webpack is designed for webpack 4 and does not support webpack 5. Upgrading webpack to 5 will break builds.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Evaluate alternative tools like electron-forge with webpack plugin or custom webpack config.","message":"The project is in maintenance mode with no recent major updates. New Electron features may not be supported.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Avoid custom Babel config; use electron-webpack's 'babel' option in package.json if needed.","message":"Babel configuration is auto-derived from Electron version; custom .babelrc may conflict.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Name CSS files with *.module.css extension to use CSS Modules.","message":"CSS Modules require specific file naming convention (e.g., *.module.css) to be enabled.","severity":"gotcha","affected_versions":">=2.7.2"},{"fix":"Use Node.js 10 or later.","message":"Node.js >=10 required; older versions may produce errors.","severity":"gotcha","affected_versions":">=2.8.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install webpack@^4.42.1 --save-dev","cause":"Missing webpack as a dependency; electron-webpack requires webpack as a peer dependency.","error":"Error: Cannot find module 'webpack'"},{"fix":"Ensure you have src/main/index.js or configure entry in package.json under 'electronWebpack'.","cause":"electron-webpack expects specific directory structure (src/main/index.js) or custom config.","error":"Error: The 'main' field in package.json must point to a valid entry file for Electron"},{"fix":"Install and configure add-on like electron-webpack-vue or electron-webpack-ts.","cause":"Missing webpack loader for the file type (e.g., .vue, .ts) without adding appropriate add-on package.","error":"Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}