The official Webpack plugin for React Cosmos (v7.3.0), a development tool for building isolated React component libraries and fixture-based testing. This plugin integrates React Cosmos with Webpack-based projects (e.g., Create React App, custom Webpack configs). React Cosmos 7 supports React 18/19 and Next.js 15, with a revamped UI, improved Vite plugin, and peer dependencies on react, react-dom, react-cosmos, and webpack. Releases follow a monthly cadence. Key differentiators: zero-config setup for Webpack, static prerendering support, and seamless integration with the Cosmos ecosystem for component-level development.
npm install react-cosmos-plugin-webpackVerified import paths — ran on the pinned version, not inferred.
Shows how to set up the Webpack plugin in cosmos.config.js, including a custom webpack config override to handle SVG files.
Use `const plugin = require('react-cosmos-plugin-webpack').default;` or switch to ESM imports.Pass webpack config override directly to the plugin via options, e.g., `[webpackPlugin({ config: { ... } })]`.Add `webpack: (config) => config` or use the plugin's built-in config handling.
Use `export default require('react-cosmos-plugin-webpack').default` or use ESM imports.Run `npm install react-cosmos-plugin-webpack --save-dev` or `yarn add react-cosmos-plugin-webpack --dev`.
Change `const webpackPlugin = require('react-cosmos-plugin-webpack');` to `const webpackPlugin = require('react-cosmos-plugin-webpack').default;`.Add appropriate Webpack rule in cosmos.config.js webpack override.