From eb7e71ebdb9c23144dd6e192c399a36786f50bec Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Wed, 31 Jul 2024 11:18:38 +0800 Subject: [PATCH 1/5] fix: align copy plugin with webpack mode (#6961) --- .changeset/curvy-ways-sleep.md | 5 +++++ packages/rspack-config/src/index.ts | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .changeset/curvy-ways-sleep.md diff --git a/.changeset/curvy-ways-sleep.md b/.changeset/curvy-ways-sleep.md new file mode 100644 index 0000000000..38aad1498c --- /dev/null +++ b/.changeset/curvy-ways-sleep.md @@ -0,0 +1,5 @@ +--- +'@ice/rspack-config': patch +--- + +feat: align copy plugin with webpack mode diff --git a/packages/rspack-config/src/index.ts b/packages/rspack-config/src/index.ts index 205a3441dd..95c415203f 100644 --- a/packages/rspack-config/src/index.ts +++ b/packages/rspack-config/src/index.ts @@ -109,12 +109,13 @@ const getConfig: GetConfig = async (options) => { fastRefresh, sourceMap, https, + enableCopyPlugin, } = taskConfig || {}; const isDev = mode === 'development'; const absoluteOutputDir = path.isAbsolute(outputDir) ? outputDir : path.join(rootDir, outputDir); const hashKey = hash === true ? 'hash:8' : (hash || ''); - const { rspack: { DefinePlugin, ProvidePlugin, SwcJsMinimizerRspackPlugin } } = await import('@ice/bundles/esm/rspack.js'); + const { rspack: { DefinePlugin, ProvidePlugin, SwcJsMinimizerRspackPlugin, CopyRspackPlugin } } = await import('@ice/bundles/esm/rspack.js'); const cssFilename = `css/${hashKey ? `[name]-[${hashKey}].css` : '[name].css'}`; // get compile plugins const compilerWebpackPlugins = getCompilerPlugins(rootDir, { @@ -280,6 +281,23 @@ const getConfig: GetConfig = async (options) => { process: [require.resolve('process/browser')], }), !!minify && new SwcJsMinimizerRspackPlugin(jsMinimizerPluginOptions), + (enableCopyPlugin || !isDev) && new CopyRspackPlugin({ + patterns: [{ + from: path.join(rootDir, 'public'), + to: absoluteOutputDir, + // ignore assets already in compilation.assets such as js and css files + force: false, + noErrorOnMissing: true, + // Skip minimization by default. + info: { + minimized: true, + }, + globOptions: { + dot: true, + gitignore: true, + }, + }], + }), ].filter(Boolean), builtins: { css: { From a7a6183b20528f8bc487e80beb4f6350e2b73876 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Wed, 31 Jul 2024 11:19:27 +0800 Subject: [PATCH 2/5] fix: modify meta.renderer in server runner (#6952) --- .changeset/pink-panthers-call.md | 5 +++++ packages/ice/src/service/ServerRunner.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/pink-panthers-call.md diff --git a/.changeset/pink-panthers-call.md b/.changeset/pink-panthers-call.md new file mode 100644 index 0000000000..a6fabe2c94 --- /dev/null +++ b/.changeset/pink-panthers-call.md @@ -0,0 +1,5 @@ +--- +'@ice/app': patch +--- + +fix: modify meta.renderer in server runner diff --git a/packages/ice/src/service/ServerRunner.ts b/packages/ice/src/service/ServerRunner.ts index 40f64fe1bc..34668aeb6e 100644 --- a/packages/ice/src/service/ServerRunner.ts +++ b/packages/ice/src/service/ServerRunner.ts @@ -170,7 +170,7 @@ class ServerRunner extends Runner { super({ rootDir, meta: { - renderer: 'client', + renderer: 'server', target: 'web', }, resolveId: async (id, importer) => { From 39b7dac6c5556efddafcea915f2f28a62ff86f14 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 15 Aug 2024 10:58:24 +0800 Subject: [PATCH 3/5] chore: lint (#6969) --- .../src/components/headStreamErrorRecoverScript.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx b/packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx index 0594bad8a7..1bd83d9a7d 100644 --- a/packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx +++ b/packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx @@ -10,8 +10,7 @@ export default function HeadStreamErrorRecoverScript({ downgradeCSRHostname }) { window.location.hostname = '${downgradeCSRHostname}'; } })`, - } - } + }} crossOrigin="anonymous" /> ); From 47a5773a1b93696ede654aeaac8c2fac2abcf1d0 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 15 Aug 2024 12:17:14 +0800 Subject: [PATCH 4/5] fix: support compileDependencies in speedup mode (#6925) --- .changeset/popular-buttons-behave.md | 5 +++++ packages/rspack-config/src/index.ts | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/popular-buttons-behave.md diff --git a/.changeset/popular-buttons-behave.md b/.changeset/popular-buttons-behave.md new file mode 100644 index 0000000000..16320714b8 --- /dev/null +++ b/.changeset/popular-buttons-behave.md @@ -0,0 +1,5 @@ +--- +'@ice/rspack-config': patch +--- + +fix: support compileDendencies in speedup mode diff --git a/packages/rspack-config/src/index.ts b/packages/rspack-config/src/index.ts index 95c415203f..288e602a09 100644 --- a/packages/rspack-config/src/index.ts +++ b/packages/rspack-config/src/index.ts @@ -170,7 +170,16 @@ const getConfig: GetConfig = async (options) => { if (!compileIncludes || compileIncludes?.length === 0) { excludeRule = 'node_modules'; } else if (!compileIncludes?.includes('node_modules') && compileIncludes?.length > 0) { - excludeRule = `node_modules[\\/](?!${compileIncludes.map((pkg: string) => { + const flattenIncludes = []; + compileIncludes.forEach((pkg) => { + if (typeof pkg === 'string') { + flattenIncludes.push(pkg); + } else { + // The RegExp type of pkg may include multiple source paths. + flattenIncludes.push(...pkg.source.split('|')); + } + }); + excludeRule = `node_modules[\\/](?!${flattenIncludes.map((pkg: string) => { return `${pkg}[\\/]|_${pkg.replace('/', '_')}@[^/]+[\\/]`; }).join('|')}).*`; } From 9c22816af350619a53a6d3faf86cba3eeb4dde23 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 15 Aug 2024 12:35:29 +0800 Subject: [PATCH 5/5] chore: update versions (#6962) --- .changeset/curvy-ways-sleep.md | 5 ----- .changeset/pink-panthers-call.md | 5 ----- .changeset/popular-buttons-behave.md | 5 ----- packages/ice/CHANGELOG.md | 9 +++++++++ packages/ice/package.json | 4 ++-- packages/plugin-i18n/package.json | 2 +- packages/rspack-config/CHANGELOG.md | 7 +++++++ packages/rspack-config/package.json | 2 +- pnpm-lock.yaml | 2 +- 9 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 .changeset/curvy-ways-sleep.md delete mode 100644 .changeset/pink-panthers-call.md delete mode 100644 .changeset/popular-buttons-behave.md diff --git a/.changeset/curvy-ways-sleep.md b/.changeset/curvy-ways-sleep.md deleted file mode 100644 index 38aad1498c..0000000000 --- a/.changeset/curvy-ways-sleep.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/rspack-config': patch ---- - -feat: align copy plugin with webpack mode diff --git a/.changeset/pink-panthers-call.md b/.changeset/pink-panthers-call.md deleted file mode 100644 index a6fabe2c94..0000000000 --- a/.changeset/pink-panthers-call.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/app': patch ---- - -fix: modify meta.renderer in server runner diff --git a/.changeset/popular-buttons-behave.md b/.changeset/popular-buttons-behave.md deleted file mode 100644 index 16320714b8..0000000000 --- a/.changeset/popular-buttons-behave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/rspack-config': patch ---- - -fix: support compileDendencies in speedup mode diff --git a/packages/ice/CHANGELOG.md b/packages/ice/CHANGELOG.md index 944faa3ec3..99297867d3 100644 --- a/packages/ice/CHANGELOG.md +++ b/packages/ice/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 3.4.11 + +### Patch Changes + +- a7a6183b: fix: modify meta.renderer in server runner +- Updated dependencies [eb7e71eb] +- Updated dependencies [47a5773a] + - @ice/rspack-config@1.1.9 + ## 3.4.10 ### Patch Changes diff --git a/packages/ice/package.json b/packages/ice/package.json index eb21ec8827..4d70612244 100644 --- a/packages/ice/package.json +++ b/packages/ice/package.json @@ -1,6 +1,6 @@ { "name": "@ice/app", - "version": "3.4.10", + "version": "3.4.11", "description": "provide scripts and configuration used by web framework ice", "type": "module", "main": "./esm/index.js", @@ -52,7 +52,7 @@ "@ice/runtime": "^1.4.10", "@ice/shared-config": "1.2.8", "@ice/webpack-config": "1.1.15", - "@ice/rspack-config": "1.1.8", + "@ice/rspack-config": "1.1.9", "@swc/helpers": "0.5.1", "@types/express": "^4.17.14", "address": "^1.1.2", diff --git a/packages/plugin-i18n/package.json b/packages/plugin-i18n/package.json index 5a7fe60ef7..552785a89d 100644 --- a/packages/plugin-i18n/package.json +++ b/packages/plugin-i18n/package.json @@ -56,7 +56,7 @@ "webpack-dev-server": "4.15.0" }, "peerDependencies": { - "@ice/app": "^3.4.10", + "@ice/app": "^3.4.11", "@ice/runtime": "^1.4.11" }, "publishConfig": { diff --git a/packages/rspack-config/CHANGELOG.md b/packages/rspack-config/CHANGELOG.md index 507fba5c98..29ccbd9318 100644 --- a/packages/rspack-config/CHANGELOG.md +++ b/packages/rspack-config/CHANGELOG.md @@ -1,5 +1,12 @@ # @ice/rspack-config +## 1.1.9 + +### Patch Changes + +- eb7e71eb: feat: align copy plugin with webpack mode +- 47a5773a: fix: support compileDendencies in speedup mode + ## 1.1.8 ### Patch Changes diff --git a/packages/rspack-config/package.json b/packages/rspack-config/package.json index 7de62a4ae7..1b63331157 100644 --- a/packages/rspack-config/package.json +++ b/packages/rspack-config/package.json @@ -1,6 +1,6 @@ { "name": "@ice/rspack-config", - "version": "1.1.8", + "version": "1.1.9", "repository": "alibaba/ice", "bugs": "https://github.com/alibaba/ice/issues", "homepage": "https://v3.ice.work", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ecb897b2f5..b876bb4902 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1660,7 +1660,7 @@ importers: specifier: 1.2.2 version: link:../route-manifest '@ice/rspack-config': - specifier: 1.1.8 + specifier: 1.1.9 version: link:../rspack-config '@ice/runtime': specifier: ^1.4.10