Registry / web-framework / canopy-webpack-config

canopy-webpack-config

JSON →
library4.4.3jsnpmunverified

Opinionated webpack 5 defaults for Canopy micro-frontend services. Current stable version 4.4.3, maintained primarily for internal Canopy use. Provides automatic AMD output, externals for common dependencies (react, react-dom, luxon, react-hook-form, @canopytax/*), babel-loader integration, and bundle analysis via webpack-bundle-analyzer. Differentiator: handles sofe service externals out of the box, supports TypeScript via object option, and remains fully overrideable without ejecting. Release cadence is irregular, driven by internal needs. Requires webpack 5, babel-loader, @babel/runtime, @babel/plugin-transform-runtime.

npm install canopy-webpack-config
INSTALL
IMPORT
SIG · CANOPY-WEBPACK-CON
C
canopy-webpack-config
web-frameworkjavascriptv4.4.3
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–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

default
✓ const canopyWebpackConfig = require('canopy-webpack-config');
✗ import canopyWebpackConfig from 'canopy-webpack-config';
Package uses CommonJS and does not support ESM imports. Use require() in Node.js environments.
default
✓ const canopyWebpackConfig = require('canopy-webpack-config'); module.exports = canopyWebpackConfig('my-app', { /* overrides */ });
✗ module.exports = canopyWebpackConfig;
The default export is a function that takes two arguments (name, config). Calling it without arguments or forgetting the name parameter is a common mistake.
TypeScript usage
✓ const canopyWebpackConfig = require('canopy-webpack-config'); module.exports = canopyWebpackConfig('my-app', { typescript: {} });
✗ module.exports = canopyWebpackConfig('my-app', { typescript: true });
Since v4.2.0, TypeScript support requires an options object (e.g., { typescript: {} }) instead of a boolean. Passing true will break.

Creates a webpack configuration for a Canopy service with custom CSS rule and output path, overriding defaults.

const canopyWebpackConfig = require('canopy-webpack-config'); const path = require('path'); module.exports = canopyWebpackConfig('my-app', { entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), }, module: { rules: [ { test: /\.css$/, use: ['style-loader', 'css-loader'], }, ], }, plugins: [ // any custom plugins ], });
Debug
Known issues
breakingIn v4.0.0, webpack 5 upgrade removed unused-files-webpack-plugin and changed webpack-dev-server command to 'webpack serve'.
fix
If using webpack-dev-server, update scripts to use 'webpack serve' instead of 'webpack-dev-server'. Remove any references to unused-files-webpack-plugin.
affects: >=4.0.0 <5.0.0
breakingIn v4.2.0, TypeScript option changed from boolean to an options object. Passing { typescript: true } breaks.
fix
Change { typescript: true } to { typescript: {} } or pass a configuration object.
affects: >=4.2.0
gotchaPackage does not install babel-loader or other loaders; you must install them separately.
fix
Add babel-loader, css-loader, etc. as devDependencies in your project and configure them in the override config.
affects: >=3.0.0
gotchaDefault export is a function that MUST be called with two arguments; simply exporting it as a config object will fail.
fix
Export the result of calling canopyWebpackConfig(name, overrides), not the function itself.
affects: >=3.0.0
deprecatedv4.1.1 fixed an overly aggressive externals rule that stripped all react-dom submodules. Users on 4.1.0 may have broken builds when using libraries like @floating-ui/react-dom.
fix
Upgrade to v4.1.1 or later.
affects: >=4.1.0 <4.1.1
Errors
Common errors & fixes
Error: Cannot find module './externals'
The externals feature expects a src/externals.ts or src/externals.js file to exist. If missing, webpack fails.
fix
Create a file at src/externals.ts (or .js) that exports an array of external module names, or disable the externals feature by not including it in your config.
TypeError: canopyWebpackConfig is not a function
Importing the package with ESM import instead of CommonJS require() or incorrectly calling the export.
fix
Use const canopyWebpackConfig = require('canopy-webpack-config'); and then call it as a function.
Module not found: Error: Can't resolve 'babel-loader'
babel-loader is not included as a dependency and must be installed separately.
fix
Run yarn add --dev babel-loader or npm install --save-dev babel-loader.
Upgrade
Version history
4.4.3latest on npm
Audit
Dependencies
@babel/runtimerequiredRequired as peer dependency for babel transforms at runtime.
@babel/plugin-transform-runtimerequiredRequired as peer dependency for babel transforms at build time.
Agent activity
30 hits · last 30 days
node
24
OpenAI (training)
2
Amazon
1
Resources
canopy-webpack-config — npm install canopy-webpack-config · libregistry