From bf16c57510067e74407255d7bbcb041e4f2ad421 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 18 Oct 2022 09:38:53 -0400 Subject: [PATCH] Provide location of babel-loader from builder-webpack5 --- code/addons/docs/package.json | 5 ----- code/addons/docs/src/preset.ts | 2 +- code/lib/builder-webpack5/src/presets/preview-preset.ts | 2 ++ code/yarn.lock | 4 ---- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/code/addons/docs/package.json b/code/addons/docs/package.json index b794e1ff27ac..cf2732bd283d 100644 --- a/code/addons/docs/package.json +++ b/code/addons/docs/package.json @@ -82,12 +82,10 @@ "@babel/core": "^7.12.10", "@storybook/mdx2-csf": "0.0.4-canary.14.04ffbe8.0", "@types/util-deprecate": "^1.0.0", - "babel-loader": "^8.2.5", "typescript": "~4.6.3" }, "peerDependencies": { "@storybook/mdx2-csf": "0.0.4-canary.14.04ffbe8.0", - "babel-loader": "^8.2.5", "react": "^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" }, @@ -95,9 +93,6 @@ "@storybook/mdx2-csf": { "optional": true }, - "babel-loader": { - "optional": true - }, "react": { "optional": true }, diff --git a/code/addons/docs/src/preset.ts b/code/addons/docs/src/preset.ts index b824eadabc2b..63eb97d0269a 100644 --- a/code/addons/docs/src/preset.ts +++ b/code/addons/docs/src/preset.ts @@ -48,7 +48,7 @@ export async function webpack( typeof createCompiler >[0] */ ) { - const resolvedBabelLoader = require.resolve('babel-loader'); + const resolvedBabelLoader = await options.presets.apply('babelLoaderRef'); const { module = {} } = webpackConfig; diff --git a/code/lib/builder-webpack5/src/presets/preview-preset.ts b/code/lib/builder-webpack5/src/presets/preview-preset.ts index eb608d16687c..4d8daace20ad 100644 --- a/code/lib/builder-webpack5/src/presets/preview-preset.ts +++ b/code/lib/builder-webpack5/src/presets/preview-preset.ts @@ -28,3 +28,5 @@ export const babel = async (config: any, options: any) => ({ }, ], }); + +export const babelLoaderRef = () => require.resolve('babel-loader'); diff --git a/code/yarn.lock b/code/yarn.lock index 7d98931990d6..cbe16dfa8443 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6478,7 +6478,6 @@ __metadata: "@storybook/store": 7.0.0-alpha.38 "@storybook/theming": 7.0.0-alpha.38 "@types/util-deprecate": ^1.0.0 - babel-loader: ^8.2.5 dequal: ^2.0.2 fs-extra: ^9.0.1 global: ^4.4.0 @@ -6490,14 +6489,11 @@ __metadata: util-deprecate: ^1.0.2 peerDependencies: "@storybook/mdx2-csf": 0.0.4-canary.14.04ffbe8.0 - babel-loader: ^8.2.5 react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 peerDependenciesMeta: "@storybook/mdx2-csf": optional: true - babel-loader: - optional: true react: optional: true react-dom: