@dinulec/bytenode-dinulec-plugin
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

@dinulec/bytenode-dinulec-plugin

Compile JavaScript into bytecode using [bytenode][link-to-bytenode].
Inspired by [bytenode-webpack-plugin][link-to-bytenode-webpack-plugin].

Install

npm install --save @dinulec/bytenode-dinulec-plugin

Supports

  • electron-forge
    • ✔️ Default configuration
  • webpack
    • ✔️ v4
    • ❔ v5
    • ✔️ entry as a string (e.g., 'src/index.js')
    • ✔️ entry as an array (e.g., ['src/index.js'])
    • ✔️ entry as an object (e.g., { main: 'src/index.js' })
    • ✔️ entry middlewares (e.g., ['src/index.js', 'webpack-hot-middleware/client'])
    • ✔️ Dynamic output.filename (e.g., '[name].js')
    • ✔️ Named output.filename (e.g., 'index.js')

Usage

import { BytenodeWebpackPlugin } from "@dinulec/bytenode-dinulec-plugin";

// webpack options
module.exports = {
  // ...

  plugins: [
    // using all defaults
    new BytenodeWebpackPlugin(),

    // overriding an option
    new BytenodeWebpackPlugin({
      compileForElectron: true,
    }),
  ],
};

Options

interface Options {
  compileAsModule: boolean; // wraps the code in a node module
  compileForElectron: boolean; // compiles for electron instead of plain node
  debugLifecycle: boolean; // enables webpack hooks lifecycle logs
  debugLogs: boolean; // enables debug logs
  keepSource: boolean; // emits the original source files along with the compiled ones
  preventSourceMaps: boolean; // prevents source maps from being generated
  silent: boolean; // disables all logs, but not errors thrown (overrides debug flags)
}

Default options

new BytenodeWebpackPlugin({
  compileAsModule: true,
  compileForElectron: false,
  debugLifecycle: false,
  debugLogs: false,
  keepSource: false,
  preventSourceMaps: true,
  silent: false,
});

Dependents (0)

Package Sidebar

Install

npm i @dinulec/bytenode-dinulec-plugin

Weekly Downloads

65

Version

5.0.0

License

MIT

Unpacked Size

37.1 kB

Total Files

26

Last publish

Collaborators

  • dinulec