storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
83.93k stars 9.21k forks source link

[webpack5] Fail to init a sb project with webpack 5 #14237

Closed prdevrf closed 3 years ago

prdevrf commented 3 years ago

Bug or support request summary

I'm trying to init a storybook project with the following command in a React + Webpack 5 project :

$ npx sb@next init --builder webpack5

and I'm getting the following error :

npm ERR! notarget No matching version found for @storybook/addon-essentials@^6.2.0-beta.15.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

Seems like I can't get one of the latest dependency of sb@next

Steps to reproduce

Initialize a webpack 5 project with React.

Webpack config file webpack.dev.config.ts : ```javascript import ESLintPlugin from "eslint-webpack-plugin"; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; import HtmlWebpackPlugin from "html-webpack-plugin"; import path from "path"; import webpack from "webpack"; const config: webpack.Configuration = { mode: "development", entry: [ "./src/index.tsx", "./src/assets/styles/main.less", ], module: { rules: [ { test: /\.css?$/, use: ["style-loader", "css-loader"] }, { test: /\.less?$/, use: ["style-loader", "css-loader", "less-loader"] }, { test: /\.(ts|js)x?$/i, exclude: /node_modules/, use: { loader: "babel-loader", options: { presets: [ "@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript", ], }, }, }, ], }, resolve: { extensions: [".tsx", ".ts", ".js"], }, plugins: [ new HtmlWebpackPlugin({ template: "src/index.html", }), new webpack.HotModuleReplacementPlugin(), new ForkTsCheckerWebpackPlugin({ async: false }), new ESLintPlugin({ extensions: ["js", "jsx", "ts", "tsx"], }), ], devtool: "inline-source-map", devServer: { contentBase: path.join(__dirname, "build"), historyApiFallback: true, port: 4000, open: true, hot: true }, }; export default config; ```

Run the following command

$ npx sb@next init --builder webpack5

Please specify which version of Storybook and optionally any affected addons that you're running

Work summary

Add missing dependencies

Acceptance criteria

The @storybook/addon-essentials@^6.2.0-beta.15 dependency should be available and I should be able to run the storybook project.

prdevrf commented 3 years ago

Seems like the dependencies have been added