From 29c46278fc7c38b3f9c68e91de056419b9735680 Mon Sep 17 00:00:00 2001 From: Patrick McDougle Date: Tue, 11 Jan 2022 13:37:34 -0800 Subject: [PATCH] Restore webpack as a dependency, update docs --- MIGRATION.md | 11 +++++++++++ app/react/package.json | 6 +++--- yarn.lock | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 039111dd1c7e..9d40f7eb8829 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -607,6 +607,17 @@ yarn add webpack@5 --dev npm install webpack@5 --save-dev ``` +Alternatively or additionally you might need to add a resolution to your package.json to ensure that a consistent webpack version is provided across all of storybook packages. Replacing the {app} with the app (react, vue, etc.) that you're using: + +```js +// package.json +... +resolutions: { + "@storybook/{app}/webpack": "^5" +} +... +``` + ### Angular 12 upgrade Storybook 6.3 supports Angular 12 out of the box when you install it fresh. However, if you're upgrading your project from a previous version, you'll need to [follow the steps for opting-in to webpack 5](#webpack-5). diff --git a/app/react/package.json b/app/react/package.json index 1d575e5493e0..ced5b17fa3b6 100644 --- a/app/react/package.json +++ b/app/react/package.json @@ -69,12 +69,12 @@ "react-refresh": "^0.11.0", "read-pkg-up": "^7.0.1", "regenerator-runtime": "^0.13.7", - "ts-dedent": "^2.0.0" + "ts-dedent": "^2.0.0", + "webpack": ">=4.43.0 <6.0.0" }, "devDependencies": { "@storybook/client-api": "6.5.0-alpha.14", - "@types/prompts": "^2.0.9", - "@types/webpack": "*" + "@types/prompts": "^2.0.9" }, "peerDependencies": { "@babel/core": "^7.11.5", diff --git a/yarn.lock b/yarn.lock index 1a80a937c134..4c97fdd3f797 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10770,7 +10770,6 @@ __metadata: "@storybook/store": 6.5.0-alpha.14 "@types/node": ^14.14.20 || ^16.0.0 "@types/prompts": ^2.0.9 - "@types/webpack": "*" "@types/webpack-env": ^1.16.0 babel-plugin-add-react-displayname: ^0.0.5 babel-plugin-named-asset-import: ^0.3.1 @@ -10783,6 +10782,7 @@ __metadata: read-pkg-up: ^7.0.1 regenerator-runtime: ^0.13.7 ts-dedent: ^2.0.0 + webpack: ">=4.43.0 <6.0.0" peerDependencies: "@babel/core": ^7.11.5 react: ^16.8.0 || ^17.0.0 @@ -49163,7 +49163,7 @@ resolve@1.19.0: languageName: node linkType: hard -"webpack@npm:4, webpack@npm:^4.0.0": +"webpack@npm:4, webpack@npm:>=4.43.0 <6.0.0, webpack@npm:^4.0.0": version: 4.46.0 resolution: "webpack@npm:4.46.0" dependencies: