rollup-plugin-webbundle

raw JSON →
0.2.0 verified Mon Apr 27 auth: no javascript

Rollup plugin to generate Web Bundles and signed Web Bundles (Isolated Web Apps). Version 0.2.0 is alpha; requires Node >=16, Rollup >=1.21.0 <4.0.0. Supports both unsigned (WBN) and signed (SWBN) bundles via integration with wbn-sign. Plugins for general web packaging and Chrome's Isolated Web Apps. No other Rollup WebBundle plugins exist, making this the primary option but highly experimental. Release cadence is low.

error Error: Cannot find module 'rollup-plugin-webbundle'
cause Package not installed or ESM-only resolution fails (missing 'exports' field).
fix
Run 'npm install rollup-plugin-webbundle --save-dev'. If using CJS, ensure Node >=14 and rollup config uses .mjs or type:'module'.
error TypeError: webbundle is not a function
cause Importing the plugin as a named import instead of default.
fix
Use 'import webbundle from 'rollup-plugin-webbundle'' instead of 'import { webbundle } from 'rollup-plugin-webbundle''.
error Error: The plugin requires Rollup >=1.21.0 <4.0.0 but you have 4.0.0
cause Incompatible Rollup version.
fix
Install Rollup 3.x with 'npm install rollup@3' or wait for plugin update.
breaking v0.2.0 changed default formatVersion from 'b1' to 'b2'. Existing bundles may not parse in older parsers.
fix Set formatVersion: 'b1' if you need backward compatibility.
deprecated Option `output` used for signed bundles is inconsistently named; expect renaming in future releases.
fix None yet; follow GitHub releases.
gotcha Requires Rollup <4.0.0 as peer dependency. Rollup v4+ not supported.
fix Downgrade Rollup to 3.x or wait for plugin update.
gotcha Node <16 may cause cryptic errors due to missing Web Streams API support.
fix Use Node >=16.0.0.
npm install rollup-plugin-webbundle
yarn add rollup-plugin-webbundle
pnpm add rollup-plugin-webbundle

Creates a Web Bundle from a Rollup build. The example sets baseURL and includes a static directory.

import webbundle from 'rollup-plugin-webbundle';

export default {
  input: 'src/index.js',
  output: { dir: 'dist', format: 'esm' },
  plugins: [
    webbundle({
      baseURL: 'https://example.com/',
      static: { dir: 'static' },
    }),
  ],
};