nexe-webpack-plugin

raw JSON →
0.1.1 verified Sat Apr 25 auth: no javascript

Webpack plugin that emits a binary package compiled by nexe, integrating the Nexe JavaScript-to-binary compiler into webpack builds. Current stable version is 0.1.1 with limited release cadence. Key differentiator: allows creating standalone executables from webpack bundles. Requires webpack ^4.0.0 as a peer dependency. Ships TypeScript types. Suitable for developers who need to distribute Node.js applications as single binaries.

error Error: Cannot find module 'nexe-webpack-plugin'
cause Package not installed or missing from node_modules.
fix
Run npm install -D nexe-webpack-plugin
error TypeError: NexePlugin is not a constructor
cause Using default import instead of named import.
fix
Change to const { NexePlugin } = require('nexe-webpack-plugin');
error Error: Cannot find module 'webpack'
cause Missing peer dependency webpack.
fix
Run npm install -D webpack@^4.0.0
gotcha NexePlugin requires webpack ^4.0.0 as peer dependency — incompatible with webpack 5.
fix Use webpack 4.x or check for updates that support webpack 5.
breaking No default export — attempting import NexePlugin from 'nexe-webpack-plugin' yields undefined.
fix Use named import: import { NexePlugin } from 'nexe-webpack-plugin'.
gotcha Nexe itself may require additional system dependencies (e.g., build tools) that are not documented in this plugin.
fix Consult nexe documentation for prerequisites.
npm install nexe-webpack-plugin
yarn add nexe-webpack-plugin
pnpm add nexe-webpack-plugin

Configures webpack to use NexePlugin to compile entry.js into a standalone binary sample-bin.

// webpack.config.js
const { NexePlugin } = require('nexe-webpack-plugin');
const { resolve } = require('path');

module.exports = {
  mode: 'development',
  entry: './entry.js',
  output: {
    path: resolve(__dirname, 'build'),
  },
  plugins: [
    new NexePlugin({
      output: 'sample-bin',
    }),
  ],
};