Registry / devops / webpack-addons

webpack-addons

JSON →
library1.1.5jsnpmunverified

webpack-addons is a utility suite designed to assist in creating webpack-cli addons by providing helper functions for common webpack configuration patterns and interactive Inquirer.js prompts. Originally published in 2017, its latest version is 1.1.5. This package is specifically tailored for scaffolding webpack configurations programmatically, offering utilities like `parseValue` for special string formatting, and `createArrowFunction` for dynamic entry points. A key differentiator was its inclusion of a `createCommonsChunkPlugin` helper, which is now deprecated in Webpack 4+ in favor of `optimization.splitChunks`. Given its last update date and the deprecation of core Webpack features it wraps, the package is considered unmaintained and potentially incompatible with modern webpack versions.

npm install webpack-addons
INSTALL
IMPORT
SIG · WEBPACK-ADDONS
W
webpack-addons
devopsjavascriptv1.1.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

parseValue
const { parseValue } = require('webpack-addons');
import { parseValue } from 'webpack-addons'; /* This package is CommonJS only */
Use named destructuring from `require` for individual functions.
createArrowFunction
const createArrowFunction = require('webpack-addons').createArrowFunction;
import createArrowFunction from 'webpack-addons/createArrowFunction'; /* Incorrect import path and ESM syntax */
Access specific utilities as properties of the main `webpack-addons` export.
List
const { List } = require('webpack-addons');
require('webpack-addons/inquirer').List; /* Inquirer utilities are directly exported */
Inquirer prompt helpers like `List` are directly exported by the main package.

Demonstrates the use of `parseValue` for configuring webpack output, `createArrowFunction` for entry points, and the structure of an Inquirer `List` prompt utility within a simulated webpack-cli addon generator.

const { parseValue, createArrowFunction, List } = require('webpack-addons'); // Simulate a webpack-cli addon's generator context class WebpackAddonGenerator { constructor() { this.configuration = { myScaffold: { webpackOptions: {} } }; } // Example of applying utilities to webpack configuration applyConfiguration() { this.configuration.myScaffold.webpackOptions.output = { sourcePrefix: parseValue('\t\t') }; this.configuration.myScaffold.webpackOptions.entry = createArrowFunction('src/main.js'); console.log('Generated Webpack Output Source Prefix:', this.configuration.myScaffold.webpackOptions.output.sourcePrefix); console.log('Generated Webpack Entry:', this.configuration.myScaffold.webpackOptions.entry()); } // Example of using an Inquirer prompt (requires actual Inquirer setup in a CLI) async promptUser() { // In a real CLI, this would be await inquirer.prompt(...) const entryChoice = List( 'entryType', 'What kind of entry do you want?', ['String', 'Function', 'Object'] ); console.log('Simulated Inquirer List prompt for entryType:', entryChoice.name, entryChoice.choices); } } const generator = new WebpackAddonGenerator(); generator.applyConfiguration(); generator.promptUser();
Debug
Known issues
breakingThe `createCommonsChunkPlugin` utility provided by `webpack-addons` wraps Webpack's `CommonsChunkPlugin`, which was officially removed in Webpack v4. Using this utility with Webpack v4 or newer will result in an error or unexpected behavior, as the underlying plugin no longer exists. Modern Webpack uses `optimization.splitChunks` for code splitting.
fix
Avoid using `createCommonsChunkPlugin`. For code splitting, configure `optimization.splitChunks` directly in your webpack configuration for Webpack v4+.
affects: >=1.0.0
gotchaThis package is CommonJS-only, relying on `require()` for module imports. It does not provide ESM exports, meaning direct `import` statements in an ES Module context will fail. This limits its compatibility in modern JavaScript projects that primarily use ESM.
fix
If integrating into an ESM project, consider using dynamic `import()` or a CommonJS wrapper. Best practice is to avoid this package in new ESM-first projects unless a specific, non-breaking utility is absolutely required.
affects: >=1.0.0
gotchaThe `webpack-addons` package appears to be unmaintained, with its last known update being in 2017. This means it may not be compatible with recent versions of Node.js, `webpack-cli`, or Webpack itself, and will not receive security patches or bug fixes for new issues. Proceed with caution when integrating into current projects.
fix
Thoroughly test compatibility with your specific environment. For new projects, consider modern alternatives or reimplementing the necessary utility functions directly.
affects: >=1.1.5
gotchaThe package does not ship with TypeScript type definitions. Developers using TypeScript will need to create their own declaration files (`.d.ts`) or use `any` types, leading to a loss of type safety and IDE assistance when interacting with `webpack-addons`'s utilities.
fix
Create a `webpack-addons.d.ts` file in your project or use a community-maintained `@types/webpack-addons` if available (though unlikely for an unmaintained package). Define interfaces for the exported functions to gain type checking benefits.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: webpack.optimize.CommonsChunkPlugin is not a constructor
Attempting to use `createCommonsChunkPlugin` with Webpack v4 or newer, where `CommonsChunkPlugin` has been removed.
fix
Remove all calls to `createCommonsChunkPlugin`. Implement code splitting using Webpack's `optimization.splitChunks` configuration instead.
SyntaxError: Cannot use import statement outside a module
Attempting to use ES module `import` syntax (`import { ... } from 'webpack-addons'`) in a CommonJS module context, or when Node.js is not configured for ESM.
fix
Replace `import` statements with CommonJS `require()` syntax, e.g., `const { parseValue } = require('webpack-addons');`. Ensure your file is treated as CommonJS (e.g., `.js` extension without `"type": "module"` in `package.json`).
Upgrade
Version history
1.1.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
webpack-addons — npm install webpack-addons · libregistry