From fd95d726388b58a7211c7b0f06e0e8cc5e9d4ff7 Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Thu, 4 Jan 2024 16:51:19 +0800 Subject: [PATCH 1/2] refactor: move swc helpers and react-refresh as peer --- diffcases/arco-pro/package.json | 1 + examples/arco-pro/package.json | 8 +- examples/builtin-swc-loader/package.json | 3 +- examples/cra-ts/package.json | 2 + examples/cra/package.json | 2 + .../module-federation-v1.5/app/package.json | 1 + .../module-federation-v1.5/lib1/package.json | 1 + .../module-federation-v1.5/lib2/package.json | 1 + .../module-federation-v1/app/package.json | 1 + .../module-federation-v1/lib1/package.json | 1 + .../module-federation-v1/lib2/package.json | 1 + examples/react-15/package.json | 1 + examples/react-storybook/package.json | 6 +- examples/react-with-less/package.json | 8 +- examples/react-with-sass/package.json | 4 +- examples/react/package.json | 1 + examples/styled-components/package.json | 8 +- examples/svgr/package.json | 9 +- .../template-react-ts/package.json | 3 +- .../create-rspack/template-react/package.json | 3 +- packages/playground/package.json | 2 + packages/rspack/package.json | 3 - packages/rspack/src/rspackOptionsApply.ts | 2 - packages/rspack/src/web/ResolveSwcPlugin.ts | 22 -- pnpm-lock.yaml | 227 +++++++++++++++--- 25 files changed, 249 insertions(+), 72 deletions(-) delete mode 100644 packages/rspack/src/web/ResolveSwcPlugin.ts diff --git a/diffcases/arco-pro/package.json b/diffcases/arco-pro/package.json index c559f3595e1..ad6941299b5 100644 --- a/diffcases/arco-pro/package.json +++ b/diffcases/arco-pro/package.json @@ -50,6 +50,7 @@ "less-loader": "^11.1.0", "mini-css-extract-plugin": "^2.6.1", "postcss-loader": "7.0.2", + "react-refresh": "^0.14.0", "serve": "14.1.2", "style-loader": "^3.3.3", "swc-loader": "^0.2.3", diff --git a/examples/arco-pro/package.json b/examples/arco-pro/package.json index 33f0f580e7c..2b77c6fde66 100644 --- a/examples/arco-pro/package.json +++ b/examples/arco-pro/package.json @@ -16,6 +16,7 @@ "@arco-design/web-react": "2.29.2", "@arco-themes/react-arco-pro": "^0.0.7", "@loadable/component": "^5.15.2", + "@swc/helpers": "0.5.1", "@turf/turf": "^6.5.0", "arco-design-pro": "^2.3.0", "axios": "^0.24.0", @@ -37,19 +38,20 @@ "regenerator-runtime": "0.13.9" }, "devDependencies": { - "serve": "14.1.2", - "@rspack/plugin-react-refresh": "workspace:*", "@rspack/cli": "workspace:*", "@rspack/core": "workspace:*", "@rspack/plugin-html": "workspace:*", + "@rspack/plugin-react-refresh": "workspace:*", "@svgr/webpack": "^6.5.1", "@swc/core": "^1.3.14", "bundle-stats": "^4.1.2", "css-loader": "^6.7.1", "html-webpack-plugin": "^5.5.0", "less-loader": "^11.1.0", - "postcss-loader": "7.0.2", "mini-css-extract-plugin": "^2.6.1", + "postcss-loader": "7.0.2", + "react-refresh": "^0.14.0", + "serve": "14.1.2", "style-loader": "^3.3.1", "swc-loader": "^0.2.3" }, diff --git a/examples/builtin-swc-loader/package.json b/examples/builtin-swc-loader/package.json index a6d77888a1c..37fb8c49745 100644 --- a/examples/builtin-swc-loader/package.json +++ b/examples/builtin-swc-loader/package.json @@ -19,6 +19,7 @@ "react-refresh": "0.14.0" }, "devDependencies": { - "@rspack/core": "workspace:*" + "@rspack/core": "workspace:*", + "@swc/helpers": "0.5.1" } } \ No newline at end of file diff --git a/examples/cra-ts/package.json b/examples/cra-ts/package.json index 83633d1df17..0f1a324c343 100644 --- a/examples/cra-ts/package.json +++ b/examples/cra-ts/package.json @@ -3,6 +3,7 @@ "version": "0.1.1", "private": true, "dependencies": { + "@swc/helpers": "0.5.1", "react": "^18.2.0", "react-dom": "^18.2.0" }, @@ -10,6 +11,7 @@ "@rspack/cli": "workspace:*", "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", + "react-refresh": "^0.14.0", "web-vitals": "^2.1.4" }, "scripts": { diff --git a/examples/cra/package.json b/examples/cra/package.json index 99af18d9f87..bbbd3429b79 100644 --- a/examples/cra/package.json +++ b/examples/cra/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@swc/helpers": "0.5.1", "react": "^18.2.0", "react-dom": "^18.2.0" }, @@ -10,6 +11,7 @@ "@rspack/cli": "workspace:*", "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", + "react-refresh": "^0.14.0", "web-vitals": "^2.1.4" }, "scripts": { diff --git a/examples/module-federation-v1.5/app/package.json b/examples/module-federation-v1.5/app/package.json index ce9ac992c66..27d2c700994 100644 --- a/examples/module-federation-v1.5/app/package.json +++ b/examples/module-federation-v1.5/app/package.json @@ -22,6 +22,7 @@ "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", "html-webpack-plugin": "^5.5.0", + "react-refresh": "^0.14.0", "serve": "14.1.2" } } \ No newline at end of file diff --git a/examples/module-federation-v1.5/lib1/package.json b/examples/module-federation-v1.5/lib1/package.json index 44a7938a5ea..9eb2520e3c5 100644 --- a/examples/module-federation-v1.5/lib1/package.json +++ b/examples/module-federation-v1.5/lib1/package.json @@ -22,6 +22,7 @@ "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", "html-webpack-plugin": "^5.5.0", + "react-refresh": "^0.14.0", "serve": "14.1.2" } } \ No newline at end of file diff --git a/examples/module-federation-v1.5/lib2/package.json b/examples/module-federation-v1.5/lib2/package.json index 87f8a2f998d..3cc1831955a 100644 --- a/examples/module-federation-v1.5/lib2/package.json +++ b/examples/module-federation-v1.5/lib2/package.json @@ -22,6 +22,7 @@ "@rspack/cli": "workspace:*", "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", + "react-refresh": "^0.14.0", "serve": "14.1.2" } } \ No newline at end of file diff --git a/examples/module-federation-v1/app/package.json b/examples/module-federation-v1/app/package.json index 2460066e163..aeb05d3cf67 100644 --- a/examples/module-federation-v1/app/package.json +++ b/examples/module-federation-v1/app/package.json @@ -22,6 +22,7 @@ "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", "html-webpack-plugin": "^5.5.0", + "react-refresh": "^0.14.0", "serve": "14.1.2" } } \ No newline at end of file diff --git a/examples/module-federation-v1/lib1/package.json b/examples/module-federation-v1/lib1/package.json index be88f055812..2196a7d1f66 100644 --- a/examples/module-federation-v1/lib1/package.json +++ b/examples/module-federation-v1/lib1/package.json @@ -22,6 +22,7 @@ "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", "html-webpack-plugin": "^5.5.0", + "react-refresh": "^0.14.0", "serve": "14.1.2" } } \ No newline at end of file diff --git a/examples/module-federation-v1/lib2/package.json b/examples/module-federation-v1/lib2/package.json index c14a31e302d..787c8003c39 100644 --- a/examples/module-federation-v1/lib2/package.json +++ b/examples/module-federation-v1/lib2/package.json @@ -22,6 +22,7 @@ "@rspack/cli": "workspace:*", "@rspack/core": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", + "react-refresh": "^0.14.0", "serve": "14.1.2" } } \ No newline at end of file diff --git a/examples/react-15/package.json b/examples/react-15/package.json index 3d40d37ec07..7557b0713f5 100644 --- a/examples/react-15/package.json +++ b/examples/react-15/package.json @@ -13,6 +13,7 @@ "license": "MIT", "dependencies": { "@rspack/cli": "workspace:*", + "@swc/helpers": "0.5.1", "react": "15.7.0", "react-dom": "15.7.0", "react-refresh": "0.14.0" diff --git a/examples/react-storybook/package.json b/examples/react-storybook/package.json index 02e719ab708..3412bff12b7 100644 --- a/examples/react-storybook/package.json +++ b/examples/react-storybook/package.json @@ -9,11 +9,13 @@ "storybook": "storybook dev -p 6006" }, "dependencies": { + "@swc/helpers": "0.5.1", "react": "^17.0.2", "react-dom": "^17.0.2" }, "devDependencies": { "@rspack/cli": "workspace:*", + "@rspack/core": "workspace:*", "@storybook/addon-essentials": "^7.0.0", "@storybook/addon-interactions": "^7.0.0", "@storybook/addon-links": "^7.0.0", @@ -23,8 +25,8 @@ "@types/react": "^18.0.25", "@types/react-dom": "^18.0.8", "prop-types": "^15.8.1", + "react-refresh": "^0.14.0", "storybook": "^7.0.0", - "storybook-react-rspack": "7.0.0-rc.18", - "@rspack/core": "workspace:*" + "storybook-react-rspack": "7.0.0-rc.18" } } \ No newline at end of file diff --git a/examples/react-with-less/package.json b/examples/react-with-less/package.json index 76058f4f446..aa6c3d76874 100644 --- a/examples/react-with-less/package.json +++ b/examples/react-with-less/package.json @@ -13,12 +13,14 @@ "license": "MIT", "dependencies": { "@rspack/cli": "workspace:*", + "@swc/helpers": "0.5.1", "less-loader": "11.1.0", + "normalize.css": "8.0.1", "react": "17.0.0", - "react-dom": "17.0.0", - "normalize.css": "8.0.1" + "react-dom": "17.0.0" }, "devDependencies": { - "@rspack/core": "workspace:*" + "@rspack/core": "workspace:*", + "react-refresh": "^0.14.0" } } \ No newline at end of file diff --git a/examples/react-with-sass/package.json b/examples/react-with-sass/package.json index d0f108c972d..b129fd21509 100644 --- a/examples/react-with-sass/package.json +++ b/examples/react-with-sass/package.json @@ -13,11 +13,13 @@ "license": "MIT", "dependencies": { "@rspack/cli": "workspace:*", + "@swc/helpers": "0.5.1", "react": "17.0.0", "react-dom": "17.0.0", "sass-loader": "^13.2.0" }, "devDependencies": { - "@rspack/core": "workspace:*" + "@rspack/core": "workspace:*", + "react-refresh": "^0.14.0" } } \ No newline at end of file diff --git a/examples/react/package.json b/examples/react/package.json index a48775f3136..1f070ab09b0 100644 --- a/examples/react/package.json +++ b/examples/react/package.json @@ -13,6 +13,7 @@ "license": "MIT", "dependencies": { "@rspack/cli": "workspace:*", + "@swc/helpers": "0.5.1", "react": "18.2.0", "react-dom": "18.2.0", "react-refresh": "0.14.0" diff --git a/examples/styled-components/package.json b/examples/styled-components/package.json index 4c5834c37f1..6a8bf02603d 100644 --- a/examples/styled-components/package.json +++ b/examples/styled-components/package.json @@ -9,14 +9,16 @@ "build": "rspack build" }, "dependencies": { - "styled-components": "5.3.6", + "@swc/helpers": "0.5.1", "@types/styled-components": "5.1.26", "react": "17", - "react-dom": "17" + "react-dom": "17", + "styled-components": "5.3.6" }, "devDependencies": { "@rspack/cli": "workspace:*", - "@rspack/core": "workspace:*" + "@rspack/core": "workspace:*", + "react-refresh": "^0.14.0" }, "sideEffects": false, "keywords": [], diff --git a/examples/svgr/package.json b/examples/svgr/package.json index e41778e1605..d921f748eaf 100644 --- a/examples/svgr/package.json +++ b/examples/svgr/package.json @@ -13,10 +13,13 @@ "license": "ISC", "devDependencies": { "@rspack/cli": "workspace:*", + "@rspack/core": "workspace:*", + "@svgr/webpack": "6.5.1", "react": "15", "react-dom": "15", - "url-loader": "4.1.1", - "@svgr/webpack": "6.5.1", - "@rspack/core": "workspace:*" + "url-loader": "4.1.1" + }, + "dependencies": { + "@swc/helpers": "0.5.1" } } \ No newline at end of file diff --git a/packages/create-rspack/template-react-ts/package.json b/packages/create-rspack/template-react-ts/package.json index 91bd60a26ae..f17c62c79df 100644 --- a/packages/create-rspack/template-react-ts/package.json +++ b/packages/create-rspack/template-react-ts/package.json @@ -16,6 +16,7 @@ "@rspack/plugin-react-refresh": "0.4.0", "@types/react": "18.2.0", "@types/react-dom": "18.2.1", - "typescript": "^5.0.4" + "typescript": "^5.0.4", + "react-refresh": "^0.14.0" } } \ No newline at end of file diff --git a/packages/create-rspack/template-react/package.json b/packages/create-rspack/template-react/package.json index 724d29434fb..e76b97e538b 100644 --- a/packages/create-rspack/template-react/package.json +++ b/packages/create-rspack/template-react/package.json @@ -15,6 +15,7 @@ "@rspack/cli": "0.4.0", "@rspack/core": "0.4.0", "@types/react": "^18.0.25", - "@types/react-dom": "^18.0.8" + "@types/react-dom": "^18.0.8", + "react-refresh": "^0.14.0" } } \ No newline at end of file diff --git a/packages/playground/package.json b/packages/playground/package.json index d832fc8b47a..11ed5e663af 100644 --- a/packages/playground/package.json +++ b/packages/playground/package.json @@ -18,6 +18,7 @@ "@rspack/core": "workspace:*", "@rspack/dev-server": "workspace:*", "@rspack/plugin-react-refresh": "workspace:*", + "@swc/helpers": "0.5.1", "@types/fs-extra": "11.0.1", "babel-loader": "^9.1.3", "fs-extra": "11.1.1", @@ -25,6 +26,7 @@ "postcss-loader": "^7.3.0", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-refresh": "^0.14.0", "tailwindcss": "^3.3.0", "vue": "3.3.7", "vue-loader": "^17.3.1", diff --git a/packages/rspack/package.json b/packages/rspack/package.json index aa499939a9d..1a3598b6117 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -69,14 +69,11 @@ "dependencies": { "@module-federation/runtime-tools": "0.0.0-next-20240102063242", "@rspack/binding": "workspace:*", - "@swc/helpers": "0.5.1", "browserslist": "^4.21.3", - "compare-versions": "6.0.0-rc.1", "enhanced-resolve": "5.12.0", "graceful-fs": "4.2.10", "json-parse-even-better-errors": "^3.0.0", "neo-async": "2.6.2", - "react-refresh": "0.14.0", "tapable": "2.2.1", "terminal-link": "^2.1.1", "watchpack": "^2.4.0", diff --git a/packages/rspack/src/rspackOptionsApply.ts b/packages/rspack/src/rspackOptionsApply.ts index 72ec9b17b0c..0416362c35e 100644 --- a/packages/rspack/src/rspackOptionsApply.ts +++ b/packages/rspack/src/rspackOptionsApply.ts @@ -15,7 +15,6 @@ import { } from "."; import fs from "graceful-fs"; -import { ResolveSwcPlugin } from "./web/ResolveSwcPlugin"; import { DefaultStatsFactoryPlugin } from "./stats/DefaultStatsFactoryPlugin"; import { DefaultStatsPrinterPlugin } from "./stats/DefaultStatsPrinterPlugin"; import { cleverMerge } from "./util/cleverMerge"; @@ -327,7 +326,6 @@ export class RspackOptionsApply { new WarnCaseSensitiveModulesPlugin().apply(compiler); - new ResolveSwcPlugin().apply(compiler); new WorkerPlugin( options.output.workerChunkLoading!, options.output.workerWasmLoading!, diff --git a/packages/rspack/src/web/ResolveSwcPlugin.ts b/packages/rspack/src/web/ResolveSwcPlugin.ts deleted file mode 100644 index 919f0621676..00000000000 --- a/packages/rspack/src/web/ResolveSwcPlugin.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Compiler } from "../Compiler"; -import path from "path"; -import { compareVersions } from "compare-versions"; - -export class ResolveSwcPlugin { - apply(compiler: Compiler) { - const swcHelperVersion = require("@swc/helpers/package.json").version; - if (compareVersions(swcHelperVersion, "0.5.0") === -1) { - throw new Error("Please bump @swc/helpers to ^0.5.0"); - } - const swcPath = path.dirname(require.resolve("@swc/helpers/package.json")); - const refreshPath = path.dirname(require.resolve("react-refresh")); - // redirect @swc/helpers to rspack, so user don't have to manual install it - compiler.options.resolve.alias = { - "@swc/helpers": swcPath, - // TODO: DEPRECATED: remove in v0.5.0. - // it's moved to `@rspack/plugin-react-refresh`, but it still required for `builtins.react` for now. - "react-refresh": refreshPath, - ...compiler.options.resolve.alias - }; - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73f926eed21..bb4ffbaac05 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -232,6 +232,9 @@ importers: postcss-loader: specifier: 7.0.2 version: 7.0.2(webpack@5.89.0) + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -262,6 +265,9 @@ importers: '@loadable/component': specifier: ^5.15.2 version: 5.15.2(react@17.0.2) + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 '@turf/turf': specifier: ^6.5.0 version: 6.5.0 @@ -356,6 +362,9 @@ importers: postcss-loader: specifier: 7.0.2 version: 7.0.2 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -405,6 +414,10 @@ importers: react-refresh: specifier: 0.14.0 version: 0.14.0 + devDependencies: + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 examples/bundle-splitting: devDependencies: @@ -426,6 +439,9 @@ importers: examples/cra: dependencies: + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 react: specifier: ^18.2.0 version: 18.2.0 @@ -442,12 +458,18 @@ importers: '@rspack/plugin-react-refresh': specifier: workspace:* version: link:../../packages/rspack-plugin-react-refresh + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 web-vitals: specifier: ^2.1.4 version: 2.1.4 examples/cra-ts: dependencies: + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 react: specifier: ^18.2.0 version: 18.2.0 @@ -464,6 +486,9 @@ importers: '@rspack/plugin-react-refresh': specifier: workspace:* version: link:../../packages/rspack-plugin-react-refresh + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 web-vitals: specifier: ^2.1.4 version: 2.1.4 @@ -646,6 +671,9 @@ importers: html-webpack-plugin: specifier: ^5.5.0 version: 5.5.0 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -674,6 +702,9 @@ importers: html-webpack-plugin: specifier: ^5.5.0 version: 5.5.0 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -702,6 +733,9 @@ importers: '@rspack/plugin-react-refresh': specifier: workspace:* version: link:../../../packages/rspack-plugin-react-refresh + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -730,6 +764,9 @@ importers: html-webpack-plugin: specifier: ^5.5.0 version: 5.5.0 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -758,6 +795,9 @@ importers: html-webpack-plugin: specifier: ^5.5.0 version: 5.5.0 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -786,6 +826,9 @@ importers: '@rspack/plugin-react-refresh': specifier: workspace:* version: link:../../../packages/rspack-plugin-react-refresh + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 serve: specifier: 14.1.2 version: 14.1.2 @@ -973,6 +1016,9 @@ importers: '@rspack/cli': specifier: workspace:* version: link:../../packages/rspack-cli + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 react: specifier: 18.2.0 version: 18.2.0 @@ -992,6 +1038,9 @@ importers: '@rspack/cli': specifier: workspace:* version: link:../../packages/rspack-cli + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 react: specifier: 15.7.0 version: 15.7.0 @@ -1083,6 +1132,9 @@ importers: examples/react-storybook: dependencies: + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 react: specifier: ^17.0.2 version: 17.0.2 @@ -1123,6 +1175,9 @@ importers: prop-types: specifier: ^15.8.1 version: 15.8.1 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 storybook: specifier: ^7.0.0 version: 7.0.15 @@ -1135,6 +1190,9 @@ importers: '@rspack/cli': specifier: workspace:* version: link:../../packages/rspack-cli + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 less-loader: specifier: 11.1.0 version: 11.1.0 @@ -1151,12 +1209,18 @@ importers: '@rspack/core': specifier: workspace:* version: link:../../packages/rspack + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 examples/react-with-sass: dependencies: '@rspack/cli': specifier: workspace:* version: link:../../packages/rspack-cli + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 react: specifier: 17.0.0 version: 17.0.0 @@ -1170,6 +1234,9 @@ importers: '@rspack/core': specifier: workspace:* version: link:../../packages/rspack + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 examples/solid: dependencies: @@ -1207,6 +1274,9 @@ importers: examples/styled-components: dependencies: + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 '@types/styled-components': specifier: 5.1.26 version: 5.1.26 @@ -1226,6 +1296,9 @@ importers: '@rspack/core': specifier: workspace:* version: link:../../packages/rspack + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 examples/svelte: devDependencies: @@ -1270,6 +1343,10 @@ importers: version: 4.6.1 examples/svgr: + dependencies: + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 devDependencies: '@rspack/cli': specifier: workspace:* @@ -1583,19 +1660,22 @@ importers: devDependencies: '@rspack/cli': specifier: 0.4.0 - version: 0.4.0(@rspack/core@0.4.0) + version: 0.4.0(@rspack/core@0.4.0)(react-refresh@0.14.0) '@rspack/core': specifier: 0.4.0 version: 0.4.0 '@rspack/plugin-react-refresh': specifier: 0.4.0 - version: 0.4.0 + version: 0.4.0(react-refresh@0.14.0) '@types/react': specifier: ^18.0.25 version: 18.2.0 '@types/react-dom': specifier: ^18.0.8 version: 18.2.1 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 packages/create-rspack/template-react-ts: dependencies: @@ -1608,19 +1688,22 @@ importers: devDependencies: '@rspack/cli': specifier: 0.4.0 - version: 0.4.0(@rspack/core@0.4.0) + version: 0.4.0(@rspack/core@0.4.0)(react-refresh@0.14.0) '@rspack/core': specifier: 0.4.0 version: 0.4.0 '@rspack/plugin-react-refresh': specifier: 0.4.0 - version: 0.4.0 + version: 0.4.0(react-refresh@0.14.0) '@types/react': specifier: 18.2.0 version: 18.2.0 '@types/react-dom': specifier: 18.2.1 version: 18.2.1 + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 typescript: specifier: ^5.0.4 version: 5.1.6 @@ -1673,6 +1756,9 @@ importers: '@rspack/plugin-react-refresh': specifier: workspace:* version: link:../rspack-plugin-react-refresh + '@swc/helpers': + specifier: 0.5.1 + version: 0.5.1 '@types/fs-extra': specifier: 11.0.1 version: 11.0.1 @@ -1694,6 +1780,9 @@ importers: react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) + react-refresh: + specifier: ^0.14.0 + version: 0.14.0 tailwindcss: specifier: ^3.3.0 version: 3.3.1(postcss@8.4.21) @@ -1718,15 +1807,9 @@ importers: '@rspack/binding': specifier: workspace:* version: link:../../crates/node_binding - '@swc/helpers': - specifier: 0.5.1 - version: 0.5.1 browserslist: specifier: ^4.21.3 version: 4.21.4 - compare-versions: - specifier: 6.0.0-rc.1 - version: 6.0.0-rc.1 enhanced-resolve: specifier: 5.12.0 version: 5.12.0 @@ -1739,9 +1822,6 @@ importers: neo-async: specifier: 2.6.2 version: 2.6.2 - react-refresh: - specifier: 0.14.0 - version: 0.14.0 tapable: specifier: 2.2.1 version: 2.2.1 @@ -1775,7 +1855,7 @@ importers: version: link:../rspack-test-tools '@swc/core': specifier: ^1.3.96 - version: 1.3.99(@swc/helpers@0.5.1) + version: 1.3.99 '@swc/jest': specifier: ^0.2.29 version: 0.2.29(@swc/core@1.3.99) @@ -9005,7 +9085,7 @@ packages: fsevents: 2.3.2 dev: true - /@pmmmwh/react-refresh-webpack-plugin@0.5.10: + /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.11.0): resolution: {integrity: sha512-j0Ya0hCFZPd4x40qLzbhGsh9TMtdb+CJQiso+WxLOPNasohq9cc5SNUcwsZaRH6++Xh91Xkm/xHCkuIiIu0LUA==} engines: {node: '>= 10.13'} peerDependencies: @@ -9038,11 +9118,12 @@ packages: find-up: 5.0.0 html-entities: 2.3.3 loader-utils: 2.0.4 + react-refresh: 0.11.0 schema-utils: 3.3.0 source-map: 0.7.4 dev: true - /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.11.0): + /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.14.0): resolution: {integrity: sha512-j0Ya0hCFZPd4x40qLzbhGsh9TMtdb+CJQiso+WxLOPNasohq9cc5SNUcwsZaRH6++Xh91Xkm/xHCkuIiIu0LUA==} engines: {node: '>= 10.13'} peerDependencies: @@ -9075,12 +9156,12 @@ packages: find-up: 5.0.0 html-entities: 2.3.3 loader-utils: 2.0.4 - react-refresh: 0.11.0 + react-refresh: 0.14.0 schema-utils: 3.3.0 source-map: 0.7.4 dev: true - /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.14.0): + /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0): resolution: {integrity: sha512-j0Ya0hCFZPd4x40qLzbhGsh9TMtdb+CJQiso+WxLOPNasohq9cc5SNUcwsZaRH6++Xh91Xkm/xHCkuIiIu0LUA==} engines: {node: '>= 10.13'} peerDependencies: @@ -9116,6 +9197,8 @@ packages: react-refresh: 0.14.0 schema-utils: 3.3.0 source-map: 0.7.4 + webpack: 5.76.0 + webpack-dev-server: 4.13.1(webpack@5.76.0) dev: true /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.14.0)(webpack-hot-middleware@2.25.3): @@ -9747,6 +9830,40 @@ packages: - webpack-plugin-serve dev: true + /@rspack/cli@0.4.0(@rspack/core@0.4.0)(react-refresh@0.14.0): + resolution: {integrity: sha512-bP/DSyUA+qLVVx99cmyXlrCwyID9jmbMfsMwDrn0BmY3IoBFFquhw9/5K1QBBpwlWnjGtntqeZPyAmweZ2loKw==} + hasBin: true + peerDependencies: + '@rspack/core': '>=0.4.0' + dependencies: + '@discoveryjs/json-ext': 0.5.7 + '@rspack/core': 0.4.0 + '@rspack/dev-server': 0.4.0(@rspack/core@0.4.0)(react-refresh@0.14.0) + colorette: 2.0.19 + exit-hook: 3.2.0 + interpret: 3.1.1 + rechoir: 0.8.0 + semver: 6.3.1 + webpack-bundle-analyzer: 4.6.1 + yargs: 17.6.2 + transitivePeerDependencies: + - '@swc/core' + - '@types/express' + - '@types/webpack' + - bufferutil + - debug + - esbuild + - react-refresh + - sockjs-client + - supports-color + - type-fest + - uglify-js + - utf-8-validate + - webpack-cli + - webpack-hot-middleware + - webpack-plugin-serve + dev: true + /@rspack/core@0.1.12: resolution: {integrity: sha512-FoQP24Zp5YEsqS9FemsMuQ4XIj3oxUNjM4qHKwAmhPLx7J9D2TO0DCTcJQMiwfJ2pxWjjFaJRBpdE2iMEG+FZg==} dependencies: @@ -9931,6 +10048,40 @@ packages: - webpack-plugin-serve dev: true + /@rspack/dev-server@0.4.0(@rspack/core@0.4.0)(react-refresh@0.14.0): + resolution: {integrity: sha512-qi70BKcGspjlNpufF+AOf5MHbEGnumMtVTtWzdw8I4xDWr2AguesrOEgACHMJx/EZks9vtbSqepf4anYglvsng==} + peerDependencies: + '@rspack/core': '*' + dependencies: + '@rspack/core': 0.4.0 + '@rspack/plugin-react-refresh': 0.4.0(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0) + chokidar: 3.5.3 + connect-history-api-fallback: 2.0.0 + express: 4.18.1 + http-proxy-middleware: 2.0.6 + mime-types: 2.1.35 + webpack: 5.76.0 + webpack-dev-middleware: 6.0.2(webpack@5.76.0) + webpack-dev-server: 4.13.1(webpack@5.76.0) + ws: 8.8.1 + transitivePeerDependencies: + - '@swc/core' + - '@types/express' + - '@types/webpack' + - bufferutil + - debug + - esbuild + - react-refresh + - sockjs-client + - supports-color + - type-fest + - uglify-js + - utf-8-validate + - webpack-cli + - webpack-hot-middleware + - webpack-plugin-serve + dev: true + /@rspack/plugin-html@0.1.12(@rspack/core@0.1.12): resolution: {integrity: sha512-psXGN6DPnerEzazbeANfyc+E/ehhv1ouu6IdJtJaqfQf1kzQcJMs19lBNlfq6TxoVD6oS8BGigoYH7XrlQZRmQ==} peerDependencies: @@ -9947,7 +10098,7 @@ packages: tapable: 2.2.1 dev: true - /@rspack/plugin-react-refresh@0.4.0: + /@rspack/plugin-react-refresh@0.4.0(react-refresh@0.14.0): resolution: {integrity: sha512-yo2FXVj6P2HrBGIxBqqRJQzAdG6CrL0WFE+kQk/Uz+7Ct09nPvl7zRdHE1BUXHnSXIjrMJj4fRmd7hXsmtTHXQ==} peerDependencies: react-refresh: '>=0.10.0 <1.0.0' @@ -9955,7 +10106,28 @@ packages: react-refresh: optional: true dependencies: - '@pmmmwh/react-refresh-webpack-plugin': 0.5.10 + '@pmmmwh/react-refresh-webpack-plugin': 0.5.10(react-refresh@0.14.0) + react-refresh: 0.14.0 + transitivePeerDependencies: + - '@types/webpack' + - sockjs-client + - type-fest + - webpack + - webpack-dev-server + - webpack-hot-middleware + - webpack-plugin-serve + dev: true + + /@rspack/plugin-react-refresh@0.4.0(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0): + resolution: {integrity: sha512-yo2FXVj6P2HrBGIxBqqRJQzAdG6CrL0WFE+kQk/Uz+7Ct09nPvl7zRdHE1BUXHnSXIjrMJj4fRmd7hXsmtTHXQ==} + peerDependencies: + react-refresh: '>=0.10.0 <1.0.0' + peerDependenciesMeta: + react-refresh: + optional: true + dependencies: + '@pmmmwh/react-refresh-webpack-plugin': 0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0) + react-refresh: 0.14.0 transitivePeerDependencies: - '@types/webpack' - sockjs-client @@ -11591,7 +11763,7 @@ packages: '@swc/core-win32-x64-msvc': 1.3.23 dev: true - /@swc/core@1.3.99(@swc/helpers@0.5.1): + /@swc/core@1.3.99: resolution: {integrity: sha512-8O996RfuPC4ieb4zbYMfbyCU9k4gSOpyCNnr7qBQ+o7IEmh8JCV6B8wwu+fT/Om/6Lp34KJe1IpJ/24axKS6TQ==} engines: {node: '>=10'} requiresBuild: true @@ -11602,7 +11774,6 @@ packages: optional: true dependencies: '@swc/counter': 0.1.2 - '@swc/helpers': 0.5.1 '@swc/types': 0.1.5 optionalDependencies: '@swc/core-darwin-arm64': 1.3.99 @@ -11638,7 +11809,7 @@ packages: '@swc/core': '*' dependencies: '@jest/create-cache-key-function': 27.5.1 - '@swc/core': 1.3.99(@swc/helpers@0.5.1) + '@swc/core': 1.3.99 jsonc-parser: 3.2.0 dev: true @@ -16021,6 +16192,7 @@ packages: /compare-versions@6.0.0-rc.1: resolution: {integrity: sha512-cFhkjbGY1jLFWIV7KegECbfuyYPxSGvgGkdkfM+ibboQDoPwg2FRHm5BSNTOApiauRBzJIQH7qvOJs2sW5ueKQ==} + dev: true /compressible@2.0.18: resolution: {integrity: sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==} @@ -18886,7 +19058,7 @@ packages: resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} engines: {node: '>=14.14'} dependencies: - graceful-fs: 4.2.10 + graceful-fs: 4.2.11 jsonfile: 6.1.0 universalify: 2.0.0 @@ -22896,6 +23068,7 @@ packages: /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + requiresBuild: true /multer@1.4.4-lts.1: resolution: {integrity: sha512-WeSGziVj6+Z2/MwQo3GvqzgR+9Uc+qt8SwHKh3gvNPiISKfsMfG4SvCOFYlxxgkXt7yIV2i1yczehm0EOKIxIg==} @@ -27683,7 +27856,7 @@ packages: optional: true dependencies: '@jridgewell/trace-mapping': 0.3.17 - '@swc/core': 1.3.99(@swc/helpers@0.5.1) + '@swc/core': 1.3.99 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 @@ -28057,7 +28230,7 @@ packages: optional: true dependencies: '@cspotcode/source-map-support': 0.8.1 - '@swc/core': 1.3.99(@swc/helpers@0.5.1) + '@swc/core': 1.3.99 '@tsconfig/node10': 1.0.9 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 @@ -29580,7 +29753,7 @@ packages: eslint-scope: 5.1.1 events: 3.3.0 glob-to-regexp: 0.4.1 - graceful-fs: 4.2.11 + graceful-fs: 4.2.10 json-parse-even-better-errors: 2.3.1 loader-runner: 4.3.0 mime-types: 2.1.35 From ae9ca8a23d581043daeb1ac1e4482733d8d55eb8 Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Thu, 4 Jan 2024 18:11:27 +0800 Subject: [PATCH 2/2] fix --- packages/rspack/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 1a3598b6117..8ec17f0ad3e 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -80,5 +80,13 @@ "webpack-sources": "3.2.3", "zod": "^3.21.4", "zod-validation-error": "1.3.1" + }, + "peerDependencies": { + "@swc/helpers": ">=0.5.1" + }, + "peerDependenciesMeta": { + "@swc/helpers": { + "optional": true + } } } \ No newline at end of file