webpack-defaults
raw JSON → 4.0.0 verified Sat Apr 25 auth: no javascript maintenance
Tooling to synchronize boilerplate configurations and project scaffolding across webpack ecosystem projects. Current stable version is v6.3.0 (December 2019) with irregular release cadence (multiple minor releases per month). Key differentiators: it is the official webpack-contrib scaffolding tool, providing a single source of truth for CI, linting, testing, and npm scripts. Alternatives like create-react-app or vue-cli are more opinionated for specific frameworks. Requires webpack ^4.3.0 as peer dependency. Last release v6.3.0; development appears stalled since late 2019.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/@webpack-contrib/defaults/index.js not supported. ↓
cause Package is ESM-only but tried to import via CommonJS require()
fix
Use dynamic import: import('@webpack-contrib/defaults').then(m => m.runDefaults())
error Module not found: Can't resolve '@webpack-contrib/defaults' ↓
cause Package name is scoped; webpack-defaults is the unscoped name but the published package is @webpack-contrib/defaults
fix
Ensure package name in import/require is '@webpack-contrib/defaults'
Warnings
breaking Node.js >=10.13.0 required as of v6.0.0 ↓
fix Upgrade Node.js to version 10.13.0 or higher.
breaking Support for webpack@5 dropped in v6.0.0 ↓
fix Use webpack^4.3.0. For webpack 5, consider alternative scaffolding.
deprecated Package is no longer actively maintained; last release December 2019 ↓
fix Consider using a different scaffolding tool or forking the repo.
gotcha CI configuration may be overwritten on each 'npm run defaults' ↓
fix Commit CI config changes manually; or disable auto-sync by removing the defaults script.
gotcha Installing from npm requires @webpack-contrib/defaults scope; not webpack-defaults ↓
fix Use npm install @webpack-contrib/defaults --save-dev
Install
npm install webpack-defaults yarn add webpack-defaults pnpm add webpack-defaults Imports
- defaults wrong
const defaults = require('@webpack-contrib/defaults')correctimport defaults from '@webpack-contrib/defaults' - runDefaults wrong
const runDefaults = require('@webpack-contrib/defaults').runDefaultscorrectimport { runDefaults } from '@webpack-contrib/defaults' - config wrong
const config = require('@webpack-contrib/defaults/config')correctimport { config } from '@webpack-contrib/defaults'
Quickstart
npm install @webpack-contrib/defaults --save-dev
# After install, add a script to package.json manually or run:
npm run defaults
# The 'defaults' npm script is automatically added to your package.json during install.
# To sync configurations:
node -e "import('@webpack-contrib/defaults').then(m => m.runDefaults())"