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

0.2.0 • Public • Published

Bytenode Webpack Plugin

This plugin makes it easy to use protect your source code with Bytenode by replacing your entry point with a script that can import bytecode.

In short, it turns this:

// index.js
function hello() {
  console.log("Hello, world!");
}

module.exports = hello;

Into this:

// index.js
require("bytenode");
require("./main");
// main.js
function hello() {
  console.log("Hello, world!");
}

module.exports = hello;

Setup

Install the plugin:

$ npm install bytenode-webpack-plugin

Then simply add BytenodePlugin to your configuration, passing the name of the entrypoint to shim and the new file name to the entries field.

Example

To shim entrypoint "index.js" as "main.js", here's a basic config file:

module.exports = {
  mode: "production",
  entry: {
    index: "src/index.js",
  },
  output: {
    dir: "app",
    filename: "[name].js",
  },
  plugins: [new BytenodePlugin({ entries: { index: "main" } })],
};

You can then compile main.js to bytecode using the bytenode cli.

$ bytenode app/main.js && rm ./app/main.js

Readme

Keywords

Package Sidebar

Install

npm i @sbrow/bytenode-webpack-plugin

Weekly Downloads

1

Version

0.2.0

License

GPL-3.0+

Unpacked Size

18.8 kB

Total Files

12

Last publish

Collaborators

  • sbrow