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

electron-esbuild

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-esbuild

Use esbuild with Electron for blazing fast compilation

  • 1.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
111
increased by1133.33%
Maintainers
1
Weekly downloads
 
Created
Source

electron-esbuild

github-actions

Easily integrate esbuild for your Electron environment.

Features

  • Use of esbuild for main source code building
  • Use of esbuild or webpack for renderer source code building
  • HMR for renderer and main processes
  • Full control of your esbuild configuration
  • Full control of your webpack configuration
  • Use electron-builder for final package

Create a Electron app

npx create-electron-esbuild-app --name my-app --package-manager npm --template react-typescript

Manual

npm i -D electron-esbuild

Start a development build (example)

npx electron-esbuild dev

Create a build (example)

npx electron-esbuild build
npx electron-esbuild build --no-clean # do not clean output before build

Package the app (example)

npx electron-builder

You can use this example for a starter React with TypeScript

Configuration

Create a electron-esbuild configuration electron-esbuild.config.yaml

mainConfig:
  type: esbuild # currently, only esbuild is supported for mainConfig
  path: esbuild.main.config.js
  src: src/main/main.ts
  output: dist/main
rendererConfig:
  type: esbuild # 'webpack' for using webpack in renderer, see examples/react-typescript-webpack
  path: esbuild.renderer.config.js
  html: src/renderer/index.html
  src: src/renderer/index.tsx
  output: dist/renderer

Main esbuild config

See example

const path = require('path')

/** @var {Partial<import('esbuild').BuildOptions>} */
module.exports = {
  platform: 'node',
  entryPoints: [path.resolve('src/main/main.ts')],
  bundle: true,
  target: 'node14.16.0', // electron version target
  loader: {
    '.ts': 'ts',
  },
}

Renderer esbuild configuration

See example

const path = require('path')

/** @var {Partial<import('esbuild').BuildOptions>} */
module.exports = {
  platform: 'browser',
  entryPoints: [path.resolve('src/renderer/index.tsx')],
  bundle: true,
  target: 'chrome89', // electron version target
  loader: {
    '.ts': 'ts',
    '.tsx': 'tsx',
    '.css': 'css',
  },
}

Development

electron-esbuild is built using node@>=15.12 and npm@>=7.6. Any pull-request using lower version will be rejected.

Setup

npm i
npm run build

Keywords

FAQs

Package last updated on 25 Mar 2021

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