Standalone single-spa webpack plugin
raw JSON →A webpack plugin that enables running single-spa microfrontends in standalone mode for development, as an alternative to import-map-overrides. Current stable version is 6.0.0, released with breaking changes: moduleFormat now defaults to ESM instead of SystemJS, and HtmlWebpackPlugin option is now required. The plugin rewrites the microfrontend's HTML and JS to load and mount it as a standalone single-spa application or parcel, with support for import maps, custom props, and start options. It ships TypeScript types and requires webpack and html-webpack-plugin as peer dependencies. Key differentiators: built specifically for single-spa ecosystem, supports ESM and SystemJS module formats, integrates with import-map-overrides UI, and provides a local development experience that simulates the microfrontend being part of a larger single-spa application. However, it is not equivalent to integrated mode and has known pitfalls such as updated single-spa/SystemJS versions and missing global styles/scripts.
Common errors
error Error: The standalone-single-spa-webpack-plugin requires HtmlWebpackPlugin to be added to the plugins array before it. ↓
error Module not found: Error: Can't resolve 'single-spa' ↓
error Error: StandaloneSingleSpaPlugin is not a constructor ↓
error TypeError: Cannot read properties of undefined (reading 'tap') ↓
Warnings
breaking moduleFormat now defaults to ESM rather than SystemJS in v6 ↓
breaking HtmlWebpackPlugin option is now required in v6 ↓
breaking html-webpack-plugin@3 is no longer supported in v5 ↓
deprecated urlRerouteOnly default changed to true in v3 ↓
gotcha Standalone mode is not equivalent to integrated mode; root config differences may cause issues ↓
gotcha Plugin automatically upgrades to latest SystemJS and single-spa versions, which may differ from production ↓
gotcha No global scripts, fonts, or CSS are loaded by default in standalone mode ↓
Install
npm install standalone-single-spa-webpack-plugin yarn add standalone-single-spa-webpack-plugin pnpm add standalone-single-spa-webpack-plugin Imports
- StandaloneSingleSpaPlugin wrong
import StandaloneSingleSpaPlugin from 'standalone-single-spa-webpack-plugin';correctconst StandaloneSingleSpaPlugin = require('standalone-single-spa-webpack-plugin'); - default wrong
import { StandaloneSingleSpaPlugin } from 'standalone-single-spa-webpack-plugin';correctimport StandaloneSingleSpaPlugin from 'standalone-single-spa-webpack-plugin'; - StandaloneSingleSpaPlugin wrong
import { StandaloneSingleSpaPlugin } from 'standalone-single-spa-webpack-plugin';correctimport StandaloneSingleSpaPlugin = require('standalone-single-spa-webpack-plugin');
Quickstart
// webpack.config.js
const StandaloneSingleSpaPlugin = require('standalone-single-spa-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
plugins: [
new HtmlWebpackPlugin(),
new StandaloneSingleSpaPlugin({
appOrParcelName: 'my-app',
moduleFormat: 'esm', // defaults to 'esm' in v6
activeWhen: ['/'],
importMapOverrides: true,
}),
],
devServer: {
historyApiFallback: true,
},
};