Electron Forge
  • Getting Started
  • Importing an Existing Project
  • CLI
  • Core Concepts
    • Why Electron Forge?
    • Build Lifecycle
  • Configuration
    • Configuration Overview
    • TypeScript Setup
    • Plugins
      • Webpack Plugin
      • Vite Plugin
      • Electronegativity Plugin
      • Auto Unpack Native Modules Plugin
      • Local Electron Plugin
      • Fuses Plugin
    • Makers
      • AppX
      • deb
      • DMG
      • Flatpak
      • pkg
      • RPM
      • Snapcraft
      • Squirrel.Windows
      • WiX MSI
      • ZIP
    • Publishers
      • Bitbucket
      • Electron Release Server
      • GitHub
      • Google Cloud Storage
      • Nucleus
      • S3
      • Snapcraft
    • Hooks
  • Built-in Templates
    • Webpack
    • Webpack + Typescript
    • Vite
    • Vite + TypeScript
  • Guides
    • Code Signing
      • Signing a Windows app
      • Signing a macOS app
    • Custom App Icons
    • Framework Integration
      • React
      • React with TypeScript
      • Vue 3
    • Developing with WSL
  • Advanced
    • Auto Update
    • Debugging
    • Extending Electron Forge
      • Writing Plugins
      • Writing Templates
      • Writing Makers
      • Writing Publishers
    • API Docs
Powered by GitBook
On this page
  • Installation
  • Usage

Was this helpful?

Edit on GitHub
  1. Configuration
  2. Plugins

Auto Unpack Native Modules Plugin

Reduce loading times and disk consumption by unpacking native Node modules from your Forge app's ASAR archive.

PreviousElectronegativity PluginNextLocal Electron Plugin

Last updated 2 months ago

Was this helpful?

This plugin will automatically add all native Node modules in your node_modules folder to the config option in your . If your app uses native Node modules, you should probably use this to reduce loading times and disk consumption on your users' machines.

Installation

npm install --save-dev @electron-forge/plugin-auto-unpack-natives

Usage

You must add this plugin to your array in your Forge configuration. There are currently no configuration options available for this plugin.

Asar archives are disabled by default with Electron Packager. Make sure you set your packagerConfig.asar value accordingly. This option also supports advanced configuration if you pass it an object. See the for more information.

forge.config.js
module.exports = {
  packagerConfig: {
    asar: true // or an object containing your asar options
  },
  plugins: [
    {
      name: '@electron-forge/plugin-auto-unpack-natives',
      config: {}
    }
  ]
};
asar.unpack
packagerConfig
plugins
API documentation for this option