Skip to content

Commit

Permalink
Merge pull request #19385 from storybookjs/optional-webpack
Browse files Browse the repository at this point in the history
Build: Make babel-loader an optional peer dependency
  • Loading branch information
shilman authored Oct 18, 2022
2 parents dd96c9e + f587314 commit 9bd628d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
3 changes: 0 additions & 3 deletions code/addons/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
},
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.12.12",
"@babel/preset-env": "^7.12.11",
"@jest/transform": "^26.6.2",
"@mdx-js/react": "^1.6.22",
"@storybook/addons": "7.0.0-alpha.38",
Expand All @@ -69,11 +68,9 @@
"@storybook/source-loader": "7.0.0-alpha.38",
"@storybook/store": "7.0.0-alpha.38",
"@storybook/theming": "7.0.0-alpha.38",
"babel-loader": "^8.2.5",
"dequal": "^2.0.2",
"fs-extra": "^9.0.1",
"global": "^4.4.0",
"lodash": "^4.17.21",
"remark-external-links": "^8.0.0",
"remark-slug": "^6.0.0",
"ts-dedent": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions code/lib/builder-webpack5/src/presets/preview-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ export const babel = async (config: any, options: any) => ({
},
],
});

export const babelLoaderRef = () => require.resolve('babel-loader');
5 changes: 5 additions & 0 deletions code/renderers/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
"css-loader": "*",
"vue": "^2.6.8"
},
"peerDependenciesMeta": {
"babel-loader": {
"optional": true
}
},
"engines": {
"node": ">=10.13.0"
},
Expand Down
5 changes: 5 additions & 0 deletions code/renderers/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
"babel-loader": "^7.0.0 || ^8.0.0",
"vue": "^3.0.0"
},
"peerDependenciesMeta": {
"babel-loader": {
"optional": true
}
},
"engines": {
"node": ">=10.13.0"
},
Expand Down
9 changes: 6 additions & 3 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6457,7 +6457,6 @@ __metadata:
dependencies:
"@babel/core": ^7.12.10
"@babel/plugin-transform-react-jsx": ^7.12.12
"@babel/preset-env": ^7.12.11
"@jest/transform": ^26.6.2
"@mdx-js/react": ^1.6.22
"@storybook/addons": 7.0.0-alpha.38
Expand All @@ -6478,11 +6477,9 @@ __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
lodash: ^4.17.21
remark-external-links: ^8.0.0
remark-slug: ^6.0.0
ts-dedent: ^2.0.0
Expand Down Expand Up @@ -8970,6 +8967,9 @@ __metadata:
"@babel/core": "*"
babel-loader: ^7.0.0 || ^8.0.0
vue: ^3.0.0
peerDependenciesMeta:
babel-loader:
optional: true
languageName: unknown
linkType: soft

Expand All @@ -8994,6 +8994,9 @@ __metadata:
babel-loader: ^7.0.0 || ^8.0.0
css-loader: "*"
vue: ^2.6.8
peerDependenciesMeta:
babel-loader:
optional: true
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 9bd628d

Please sign in to comment.