Skip to content

Commit

Permalink
fix(monorepo): ignore unnessary react peers from antd (#3487)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng committed Apr 19, 2023
1 parent b965df2 commit 4baf588
Show file tree
Hide file tree
Showing 11 changed files with 240 additions and 422 deletions.
11 changes: 11 additions & 0 deletions .changeset/nasty-readers-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@modern-js/builder-webpack-provider': patch
'@modern-js/builder-rspack-provider': patch
'@e2e/webpack-builder-import-antd-v4': patch
'@e2e/webpack-builder-import-antd-v5': patch
'@modern-js/builder-plugin-swc': patch
---

fix(monorepo): ignore unnessary peer deps warning from antd

fix(monorepo): 忽略由 antd 造成的不必要的 peer deps 警告
4 changes: 3 additions & 1 deletion packages/builder/builder-webpack-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@
"@types/caniuse-lite": "^1.0.1",
"@types/node": "^14",
"antd": "4",
"typescript": "^4"
"typescript": "^4",
"react": "^18",
"react-dom": "^18"
},
"peerDependencies": {
"@modern-js/e2e": "workspace:^2.13.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ exports[`webpackConfig > should set proper pluginImport option in Babel 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -404,7 +404,7 @@ exports[`webpackConfig > should set proper pluginImport option in Babel 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ exports[`plugins/babel > should add rule to compile Data URI when enable source.
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -216,7 +216,7 @@ exports[`plugins/babel > should add rule to compile Data URI when enable source.
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -334,7 +334,7 @@ exports[`plugins/babel > should adjust browserslist when target is node 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -438,7 +438,7 @@ exports[`plugins/babel > should adjust browserslist when target is node 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -564,7 +564,7 @@ exports[`plugins/babel > should apply exclude condition when using source.exclud
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -673,7 +673,7 @@ exports[`plugins/babel > should apply exclude condition when using source.exclud
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -802,7 +802,7 @@ exports[`plugins/babel > should override targets of babel-preset-env when using
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -909,7 +909,7 @@ exports[`plugins/babel > should override targets of babel-preset-env when using
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -1032,7 +1032,7 @@ exports[`plugins/babel > should set babel-loader 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -1141,7 +1141,7 @@ exports[`plugins/babel > should set babel-loader 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -1268,7 +1268,7 @@ exports[`plugins/babel > should set include/exclude 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -1377,7 +1377,7 @@ exports[`plugins/babel > should set include/exclude 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -668,7 +668,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -1415,7 +1415,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": false,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -1541,7 +1541,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": false,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -2226,7 +2226,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": false,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -2350,7 +2350,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": false,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -2964,7 +2964,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": false,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -3090,7 +3090,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": false,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports[`plugins/react > should work with babel-loader 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down Expand Up @@ -213,7 +213,7 @@ exports[`plugins/react > should work with babel-loader 1`] = `
"<WORKSPACE>/node_modules/<PNPM_INNER>/@babel/preset-react/lib/index.js",
{
"development": true,
"runtime": "classic",
"runtime": "automatic",
"useBuiltIns": true,
"useSpread": false,
},
Expand Down
4 changes: 3 additions & 1 deletion packages/builder/plugin-swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
"magic-string": "^0.26.2",
"source-map": "^0.7.4",
"typescript": "^4",
"webpack": "^5.76.2"
"webpack": "^5.76.2",
"react": "^18",
"react-dom": "^18"
},
"dependencies": {
"@modern-js/builder-plugin-swc-base": "workspace:*",
Expand Down
20 changes: 10 additions & 10 deletions packages/builder/plugin-swc/tests/__snapshots__/plugin.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports[`plugins/swc > should apply source.include and source.exclude correctly
"transform": {
"react": {
"refresh": true,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -95,7 +95,7 @@ exports[`plugins/swc > should apply source.include and source.exclude correctly
"transform": {
"react": {
"refresh": true,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -144,7 +144,7 @@ exports[`plugins/swc > should disable react refresh when dev.hmr is false 1`] =
"transform": {
"react": {
"refresh": false,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -194,7 +194,7 @@ exports[`plugins/swc > should disable react refresh when target is not web 1`] =
"transform": {
"react": {
"refresh": true,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -240,7 +240,7 @@ exports[`plugins/swc > should disable react refresh when target is not web 2`] =
"transform": {
"react": {
"refresh": false,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -288,7 +288,7 @@ exports[`plugins/swc > should disable react refresh when target is not web 3`] =
"transform": {
"react": {
"refresh": false,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -336,7 +336,7 @@ exports[`plugins/swc > should disable react refresh when target is not web 4`] =
"transform": {
"react": {
"refresh": true,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -384,7 +384,7 @@ exports[`plugins/swc > should disable react refresh when target is not web 5`] =
"transform": {
"react": {
"refresh": false,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -461,7 +461,7 @@ exports[`plugins/swc > should set swc-loader 1`] = `
"transform": {
"react": {
"refresh": true,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down Expand Up @@ -507,7 +507,7 @@ exports[`plugins/swc > should set swc-loader 1`] = `
"transform": {
"react": {
"refresh": true,
"runtime": "classic",
"runtime": "automatic",
},
},
},
Expand Down
Loading

0 comments on commit 4baf588

Please sign in to comment.