A webpack configuration preset for building in-browser microfrontend modules used with single-spa. Current stable version is 8.0.0, with a moderate release cadence following single-spa ecosystem updates. It simplifies webpack setup by automatically applying single-spa-specific plugins and loaders: sets output.libraryTarget to 'system', adds externals for single-spa dependencies, and configures standalone development mode. Compared to manual webpack configs, it reduces boilerplate and ensures compatibility with single-spa's module lifecycle and import map. Supports React, Angular, Vue, and generic JS modules via companion packages like webpack-config-single-spa-react and webpack-config-single-spa-ts.
npm install webpack-config-single-spaVerified import paths — ran on the pinned version, not inferred.
Shows basic usage: import the default export, call it with options (projectRoot required), and optionally merge with webpack-merge to extend.
If upgrading from v7, remove the extra function call: const config = webpackConfigSingleSpa(options) instead of webpackConfigSingleSpa(options)()
Ensure all peer dependencies (webpack, single-spa, etc.) are installed: npm install webpack single-spa
Use single-spa's import map or SystemJS to load your microfrontend. Alternatively, set output.libraryTarget to 'module' if using ES modules, but that requires different polyfills.
Replace 'type' with 'moduleType' in your options object.
Upgrade to webpack@5 and adjust your webpack config for version 5 changes (e.g., module.rules instead of module.loaders).
Use import webpackConfigSingleSpa from 'webpack-config-single-spa' and ensure your package.json has "type": "module" or use .mjs extension.
Run npm install webpack@5 --save-dev
Load SystemJS (or single-spa's bundled version) in your HTML: <script src="https://unpkg.com/systemjs/dist/system.js"></script> and set up import map.
Change to: const config = webpackConfigSingleSpa(options);