Hoy creé un nuevo proyecto CRA (que funciona perfectamente) pero cuando agrego Storybook con npx sb init
, aparece este error:
info @storybook/react v6.4.9 info => Loading presets info => Serving static files from ./public at / info => Loading Webpack configuration from `node_modules/react-scripts` info => Removing existing JavaScript and TypeScript rules. info => Modifying Create React App rules. info => Using default Webpack5 setup ERR! ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. ERR! - configuration.module.rules[4] should be one of these: ERR! ["..." | object { assert?, compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }, ...]
Intenté muchas cosas sin resultados.
¿Qué podría ser?
¡Gracias!
Storybook 6.3 brinda soporte opcional para crear tanto su proyecto como la interfaz de usuario del administrador con webpack 5. Para hacerlo:
yarn add @storybook/builder-webpack5 @storybook/manager-webpack5 --dev # or npm install @storybook/builder-webpack5 @storybook/manager-webpack5 --save-dev
Luego edite su configuración .storybook/main.js:
module.exports = { core: { builder: 'webpack5', }, };
El paquete web se ha inicializado con un objeto de configuración que no coincide con el esquema de la API.
Revise la configuración de su paquete web: https://storybook.js.org/docs/react/configure/webpack