{"id":20862,"library":"wext-manifest-webpack-plugin","title":"wext-manifest-webpack-plugin","description":"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.","status":"active","version":"1.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/abhijithvijayan/wext-manifest-webpack-plugin","tags":["javascript","webextension","manifest","webpack","plugin","wext","chrome","firefox","edge","typescript"],"install":[{"cmd":"npm install wext-manifest-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add wext-manifest-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add wext-manifest-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CJS-only package; does not support ESM import. TypeScript users must use require or enable esModuleInterop.","wrong":"import WextManifestWebpackPlugin from 'wext-manifest-webpack-plugin';","symbol":"WextManifestWebpackPlugin","correct":"const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');"},{"note":"For TypeScript with CJS interop, use import = require or enable esModuleInterop.","wrong":"import WextManifestWebpackPlugin from 'wext-manifest-webpack-plugin';","symbol":"WextManifestWebpackPlugin","correct":"import WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');"},{"note":"The constructor takes no options. Passing options will be silently ignored.","wrong":"new WextManifestWebpackPlugin({ ... options })","symbol":"Plugin","correct":"new WextManifestWebpackPlugin()"}],"quickstart":{"code":"const path = require('path');\nconst WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');\n\nconst destPath = path.resolve(__dirname, 'dist');\nconst targetBrowser = 'chrome';\n\nmodule.exports = {\n  entry: {\n    manifest: './source/manifest.json',\n  },\n  output: {\n    path: path.join(destPath, targetBrowser),\n    filename: 'js/[name].js',\n  },\n  module: {\n    rules: [\n      {\n        type: 'javascript/auto',\n        test: /\\.json$/,\n        use: 'wext-manifest-loader',\n        exclude: /node_modules/,\n      },\n    ],\n  },\n  plugins: [\n    new WextManifestWebpackPlugin(),\n  ],\n};","lang":"javascript","description":"Demonstrates basic webpack config using the plugin with wext-manifest-loader for a Chrome extension."},"warnings":[{"fix":"Add wext-manifest-loader as a devDependency and configure a webpack rule for manifest.json with type: 'javascript/auto'.","message":"Plugin requires wext-manifest-loader for JSON handling; omission causes manifest not to be copied.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Instantiate with new WextManifestWebpackPlugin() without arguments.","message":"Plugin does not accept any constructor options; passing options may lead to silent failures.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use require() or configure bundler accordingly.","message":"The plugin is CJS-only; using ES module import will fail.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to wext-manifest-webpack-plugin >=1.4.0 and webpack >=5.","message":"Webpack 4 support is considered deprecated; upgrade to webpack 5 for best compatibility.","severity":"deprecated","affected_versions":"1.3.x"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');","cause":"Using ES module import with default export on a CJS-only package.","error":"TypeError: WextManifestWebpackPlugin is not a constructor"},{"fix":"Install wext-manifest-loader: npm install --save-dev wext-manifest-loader","cause":"Missing wext-manifest-loader dependency required for processing manifest.json.","error":"Module not found: Error: Can't resolve 'wext-manifest-loader'"},{"fix":"Add rule with type: 'javascript/auto' and use: 'wext-manifest-loader' for manifest.json files.","cause":"Webpack attempts to parse manifest.json with default JSON loaders instead of wext-manifest-loader.","error":"Unexpected token 'export' in manifest.json"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}