Shared webpack configuration builder for Scratch projects, version 3.1.2 as of March 2026. Provides a fluent API to construct webpack 5 configurations with defaults for Scratch's build pipeline, including Babel (with optional React), CSS (postcss-loader, css-loader, style-loader), TypeScript (ts-loader), asset modules via resource queries, chunk splitting, and target-specific externals for browserslist and Node. Released under BSD-3-Clause (was AGPL-3.0 in v2). Differentiators: opinionated but extensible via clone/merge, handles Scratch-specific module rules and externals, and integrates with Scratch's semantic release config. Requires webpack 5 and peer dependencies like @babel/preset-env, babel-loader, css-loader, postcss-loader, etc.
npm install scratch-webpack-configurationVerified import paths — ran on the pinned version, not inferred.
Shows creating a ScratchWebpackConfigBuilder, enabling React, setting target to browserslist, adding a CSS loader rule, and a CopyWebpackPlugin.
Update to v3.0.0+ to use BSD-3-Clause license.
Use import syntax or dynamic import(). If you must use CommonJS, stay on v1.x (v2.x is also AGPL).
Install all peer deps listed in the package.json. Missing css-loader/url-loader will cause build failures.
Ensure Node.js >=14 and webpack ^5.90.3.
Add @babel/preset-react to devDependencies.
Run npm install scratch-webpack-configuration --save-dev
Change import { ScratchWebpackConfigBuilder } to import ScratchWebpackConfigBuildernpm install css-loader --save-dev
Update to v3 and review legal implications.