Registry / devops / wext-manifest-webpack-plugin

wext-manifest-webpack-plugin

JSON →
library1.4.1jsnpmunverified

Webpack plugin that solves the problem of generating JS files for manifest.json entries in web extensions (Chrome, Firefox, Edge, Opera). It automatically finds JS files referenced in the manifest entry, copies the manifest to the output, and removes the generated JS file from the compilation to avoid duplicate or extraneous output. Version 1.4.1 supports both webpack 4 and 5. It is commonly used with wext-manifest-loader and the web-extension-starter project. The plugin is maintained by a single developer with updates focused on compatibility and stability. It fills a niche gap not addressed by other webpack extension plugins like @pmmmwh/react-refresh-webpack-plugin or webpack-ext-reloader by providing a minimal, focused solution for manifest handling.

npm install wext-manifest-webpack-plugin
INSTALL
IMPORT
SIG · WEXT-MANIFEST-WEBP
W
wext-manifest-webpack-plugin
devopsjavascriptv1.4.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WextManifestWebpackPlugin
✓ const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');
✗ import WextManifestWebpackPlugin from 'wext-manifest-webpack-plugin';
CJS-only package; does not support ESM import. TypeScript users must use require or enable esModuleInterop.
WextManifestWebpackPlugin
✓ import WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');
✗ import WextManifestWebpackPlugin from 'wext-manifest-webpack-plugin';
For TypeScript with CJS interop, use import = require or enable esModuleInterop.
Plugin
✓ new WextManifestWebpackPlugin()
✗ new WextManifestWebpackPlugin({ ... options })
The constructor takes no options. Passing options will be silently ignored.

Demonstrates basic webpack config using the plugin with wext-manifest-loader for a Chrome extension.

const path = require('path'); const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin'); const destPath = path.resolve(__dirname, 'dist'); const targetBrowser = 'chrome'; module.exports = { entry: { manifest: './source/manifest.json', }, output: { path: path.join(destPath, targetBrowser), filename: 'js/[name].js', }, module: { rules: [ { type: 'javascript/auto', test: /\.json$/, use: 'wext-manifest-loader', exclude: /node_modules/, }, ], }, plugins: [ new WextManifestWebpackPlugin(), ], };
Debug
Known issues
gotchaPlugin requires wext-manifest-loader for JSON handling; omission causes manifest not to be copied.
fix
Add wext-manifest-loader as a devDependency and configure a webpack rule for manifest.json with type: 'javascript/auto'.
affects: >=1.0.0
gotchaPlugin does not accept any constructor options; passing options may lead to silent failures.
fix
Instantiate with new WextManifestWebpackPlugin() without arguments.
affects: >=1.0.0
gotchaThe plugin is CJS-only; using ES module import will fail.
fix
Use require() or configure bundler accordingly.
affects: >=1.0.0
deprecatedWebpack 4 support is considered deprecated; upgrade to webpack 5 for best compatibility.
fix
Upgrade to wext-manifest-webpack-plugin >=1.4.0 and webpack >=5.
affects: 1.3.x
Errors
Common errors & fixes
TypeError: WextManifestWebpackPlugin is not a constructor
Using ES module import with default export on a CJS-only package.
fix
Use const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');
Module not found: Error: Can't resolve 'wext-manifest-loader'
Missing wext-manifest-loader dependency required for processing manifest.json.
fix
Install wext-manifest-loader: npm install --save-dev wext-manifest-loader
Unexpected token 'export' in manifest.json
Webpack attempts to parse manifest.json with default JSON loaders instead of wext-manifest-loader.
fix
Add rule with type: 'javascript/auto' and use: 'wext-manifest-loader' for manifest.json files.
Upgrade
Version history
1.4.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
wext-manifest-webpack-plugin — npm install wext-manifest-webpack-plugin · libregistry