Registry / devops / wranglerjs-compat-webpack-plugin

wranglerjs-compat-webpack-plugin

JSON →
library0.0.8jsnpmunverified

A Webpack plugin that emulates Wrangler v1's `type = webpack` configuration, enabling seamless migration of Cloudflare Workers projects using Wrangler v1's webpack setup to modern tooling. Current version 0.0.8 is pre-stable with experimental support; released irregularly under the workers-sdk monorepo. Key differentiator: bridges the gap between legacy Wrangler v1 webpack configs and new Wrangler v2+ without manual reconfiguration, preserving build compatibility for workers relying on `type = webpack`.

npm install wranglerjs-compat-webpack-plugin
INSTALL
IMPORT
SIG · WRANGLERJS-COMPAT-
W
wranglerjs-compat-webpack-plugin
devopsjavascriptv0.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

WranglerJSCompatWebpackPlugin
import WranglerJSCompatWebpackPlugin from 'wranglerjs-compat-webpack-plugin'
const { WranglerJSCompatWebpackPlugin } = require('wranglerjs-compat-webpack-plugin');
Default export only; named export also available but not recommended. Requires Webpack >=4.
WranglerJSCompatWebpackPlugin
const WranglerJSCompatWebpackPlugin = require('wranglerjs-compat-webpack-plugin').default;
const WranglerJSCompatWebpackPlugin = require('wranglerjs-compat-webpack-plugin');
CommonJS require must use .default to get the constructor.
WranglerJSCompatWebpackPlugin
import { WranglerJSCompatWebpackPlugin } from 'wranglerjs-compat-webpack-plugin'
import { WranglerJSCompatWebpackPlugin } from 'wranglerjs-compat-webpack-plugin';
Named export available since v0.0.6; same as default export.

Shows basic usage of the plugin in a webpack config to emulate Wrangler v1's type=webpack for Cloudflare Workers.

const path = require('path'); const WranglerJSCompatWebpackPlugin = require('wranglerjs-compat-webpack-plugin').default; module.exports = { entry: './src/index.js', target: 'webworker', plugins: [ new WranglerJSCompatWebpackPlugin({ // Optional: any options that Wrangler v1 webpack config would have used }) ], output: { path: path.resolve(__dirname, 'dist'), filename: 'worker.js', }, };
Debug
Known issues
breakingThe plugin is experimental (v0.0.8) and may have breaking changes without major version bump.
fix
Pin exact version and test thoroughly before each update.
affects: 0.x
deprecatedWrangler v1 type=webpack is deprecated; the plugin is intended for migration only.
fix
Migrate to Wrangler v2+ and adopt modern build tooling.
affects: >=0.0.1
gotchaRequires Webpack >=4; does not support Webpack 5 in all scenarios due to changes in target: 'webworker'.
fix
Ensure Webpack 5 compatibility by checking the plugin's peer dependency and using appropriate node polyfills if needed.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'wranglerjs-compat-webpack-plugin'
Package not installed or incorrect import path.
fix
Run `npm install wranglerjs-compat-webpack-plugin --save-dev` and ensure import uses default export.
TypeError: WranglerJSCompatWebpackPlugin is not a constructor
Using CommonJS require without .default property.
fix
Use `const WranglerJSCompatWebpackPlugin = require('wranglerjs-compat-webpack-plugin').default;`
Configuration error: 'target' must be 'webworker' for Cloudflare Workers
Missing or incorrect webpack target.
fix
Add `target: 'webworker'` to webpack configuration.
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies
webpackrequiredPeer dependency; plugin integrates directly with webpack's build pipeline.
Agent activity
11 hits · last 30 days
node
10
Resources
wranglerjs-compat-webpack-plugin — npm install wranglerjs-compat-webpack-plugin · libregistry