Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-webpack

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-webpack

Configurations and scripts to compile Electron applications.

  • 0.11.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
decreased by-35.48%
Maintainers
1
Weekly downloads
 
Created
Source

electron-webpack npm version

Configurations and scripts to compile Electron applications.

Install

  1. yarn add webpack electron-webpack --dev
  2. yarn add source-map-support
  3. Install support for various languages and frameworkstypescript, vue and less if need.

Yarn is recommended instead of npm.

Project Structure

├─ src
│  ├─ main # main process sources
│  │  └─ index.js
│  ├─ renderer # renderer process sources
│  │  └─ index.js
├─ static # static assets (optional directory)

Index file expected to be named as index.js or main.js (.ts if typescript support installed)

Real project example — electrify.

Hot Module Replacement

Fast development without reloading is supported for both main and renderer processes.

Package Scripts

You can add following scripts to your package.json:

{
  "scripts": {
    "dev": "electron-webpack dev",
    "compile": "electron-webpack",
    "dist": "yarn compile && electron-builder",
    "dist-dir": "yarn dist -- --dir -c.compression=store -c.mac.identity=null"
  }
}
  • yarn dev Run app in development.
  • yarn compile Compile app for production. No need to call this script explicitly, only if you want to inspect your compiled app.
  • yarn dist Build app and package in a distributable format for production.
  • yarn dist-dir Build app and quickly package in a distributable format for test how does the app work if packed.

Differences between electron-compile

  • Hot Module Replacement for virtually anything and even for main process. electron-compile live reload is limited and works only for some file types.
  • Faster Builds (e.g. typescript or generic).
  • No runtime dependencies.
  • ... and so on. electron-compile is not comparable to webpack because webpack is widely used and popular. There are a lot features, loaders and plugins. And because community is big, answers to any question. Special tool for Electron not required, electron is directly and explicitly supported by webpack.

But keep things simple. electron-compile offers you zero-config setup without predefined project structure and simple on the fly runtime transformation. And for simple projects, even direct usage of typescript/babel maybe enough (example).

Notes

  • source-map-support is recommended and supported out of the box, simply install it yarn add source-map-support and that's all.
  • webpack-build-notifier is supported, simply install it yarn add webpack-build-notifier --dev and it will automatically enabled for development.

Further Reading

See the Wiki for more documentation.

Debug

Set the DEBUG environment variable to debug what electron-webpack is doing:

DEBUG=electron-webpack:*

FAQs

Package last updated on 07 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc