Skip to content

Commit

Permalink
Fix: pack error when use speedup mode (#6727)
Browse files Browse the repository at this point in the history
* fix: update rspack version

* fix: changelog

* chore: lint
  • Loading branch information
ClarkXia authored Jan 4, 2024
1 parent 3171e61 commit 420fec8
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 120 deletions.
7 changes: 7 additions & 0 deletions .changeset/twenty-cycles-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@ice/rspack-config': patch
'@ice/bundles': patch
'@ice/app': patch
---

fix: update binding version for packing error, resolve error when disable code splitting
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
"@rspack/[email protected].3": "patches/@[email protected].3.patch"
"@rspack/[email protected].5": "patches/@[email protected].5.patch"
}
}
}
6 changes: 3 additions & 3 deletions packages/bundles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
"zod": "^3.22.3",
"zod-validation-error": "1.2.0",
"terminal-link": "^2.1.1",
"@ice/pack-binding": "0.0.4",
"@ice/pack-binding": "0.0.6",
"mime-types": "2.1.35"
},
"devDependencies": {
"@rspack/plugin-react-refresh": "0.4.3",
"@rspack/dev-server": "0.4.3",
"@rspack/core": "0.4.3",
"@rspack/dev-server": "0.4.5",
"@rspack/core": "0.4.5",
"@types/less": "^3.0.3",
"@types/lodash": "^4.14.181",
"@types/webpack-bundle-analyzer": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"unplugin": "^1.5.1",
"webpack": "^5.88.0",
"webpack-dev-server": "4.15.0",
"@rspack/core": "0.4.3",
"@rspack/core": "0.4.5",
"@rspack/dev-server": "0.4.3"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@ice/shared-config": "1.2.0"
},
"devDependencies": {
"@rspack/core": "0.4.3"
"@rspack/core": "0.4.5"
},
"scripts": {
"watch": "tsc -w --sourceMap",
Expand Down
3 changes: 2 additions & 1 deletion packages/rspack-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const getConfig: GetConfig = async (options) => {
runtimeTmpDir,
getExpandedEnvs,
runtimeDefineVars,
getRoutesFile,
localIdentName,
rspack,
} = options;
Expand Down Expand Up @@ -206,6 +205,8 @@ const getConfig: GetConfig = async (options) => {
experiments: {
rspackFuture: {
disableTransformByDefault: true,
// This configuration is make the same behaior with webpack 5.
disableApplyEntryLazily: true,
},
},
stats: 'none',
Expand Down
3 changes: 2 additions & 1 deletion packages/rspack-config/src/splitChunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export const getVendorStrategy = (options: Configuration['splitChunks']) => {

const getSplitChunks = (_: string, strategy: string | boolean) => {
if (strategy === false) {
return { minChunks: Infinity, cacheGroups: { default: false } };
// Empty splitChunks configuration if strategy is false.
return {};
} else if (typeof strategy === 'string' && ['page-vendors', 'vendors'].includes(strategy)) {
const splitChunksOptions = strategy === 'page-vendors' ? { chunks: 'all' } : {};
return getVendorStrategy(splitChunksOptions);
Expand Down
53 changes: 21 additions & 32 deletions patches/@[email protected] → patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
diff --git a/dist/config/adapter.js b/dist/config/adapter.js
index 40175429036fbeac26601c59e19c3d2ec1bebd14..5e378ec28ffe510bcffbf4c0c8a64fbf1b545c4c 100644
index ea1d21db02d413de0d25367c646cd9773fb41223..42aed198ffb18752a7a245e1f8a0f2bf845b80d5 100644
--- a/dist/config/adapter.js
+++ b/dist/config/adapter.js
@@ -17,6 +17,8 @@ const getRawOptions = (options, compiler, processResource) => {
@@ -16,6 +16,7 @@ const getRawOptions = (options, compiler, processResource) => {
const mode = options.mode;
const experiments = getRawExperiments(options.experiments);
return {
+ // CUSTOM: add options of features.
+ features: options.features,
mode,
target: getRawTarget(options.target),
context: options.context,
diff --git a/dist/config/defaults.js b/dist/config/defaults.js
index 48239ccd62799ac615d095f0df1fe20f316c6052..68db4c167b989f2fbba0e34e8d2a876c0fc2f4c5 100644
index b413bb21a053a161a64056664354a50ee6429283..9983bc69e39d031ca49fa04bcad0aea093e4b996 100644
--- a/dist/config/defaults.js
+++ b/dist/config/defaults.js
@@ -50,6 +50,12 @@ const applyRspackOptionsDefaults = (options) => {
@@ -53,6 +53,11 @@ const applyRspackOptionsDefaults = (options) => {
applyExperimentsDefaults(options.experiments, {
cache: options.cache
});
+ // CUSTOM: add default rules for features options.
+ if (options.features) {
+ applyFeaturesDefaults(options.features);
+ applyFeaturesDefaults(options.features);
+ } else {
+ D(options, 'features', {});
+ D(options, 'features', {});
+ }
applySnapshotDefaults(options.snapshot, { production });
applyModuleDefaults(options.module, {
// syncWebAssembly: options.experiments.syncWebAssembly,
@@ -125,6 +131,13 @@ const applyExperimentsDefaults = (experiments, { cache }) => {
D(experiments.rspackFuture, "disableTransformByDefault", true);
@@ -129,6 +134,13 @@ const applyExperimentsDefaults = (experiments, { cache }) => {
D(experiments.rspackFuture, "disableApplyEntryLazily", false);
}
};
+const applyFeaturesDefaults = (features) => {
+ D(features, 'split_chunks_strategy', {});
+ if (typeof features.split_chunks_strategy === 'object') {
+ D(features.split_chunks_strategy, 'name', '');
+ D(features.split_chunks_strategy, 'topLevelFrameworks', []);
+ }
+ D(features, 'split_chunks_strategy', {});
+ if (typeof features.split_chunks_strategy === 'object') {
+ D(features.split_chunks_strategy, 'name', '');
+ D(features.split_chunks_strategy, 'topLevelFrameworks', []);
+ }
+};
const applySnapshotDefaults = (snapshot, { production }) => {
F(snapshot, "module", () => production
? { timestamp: true, hash: true }
diff --git a/dist/config/normalization.js b/dist/config/normalization.js
index 1d7a4499463026c6b8bd528159c2d5edf300942c..942bfc868423c07d239a1225cf6063ecbcacc694 100644
index 7769ba679c50a63a60961cfe87f5b7b950593e85..d159573dacd63aec503be254366eea94cdddf826 100644
--- a/dist/config/normalization.js
+++ b/dist/config/normalization.js
@@ -13,6 +13,7 @@ exports.getNormalizedRspackOptions = void 0;
Expand All @@ -55,24 +53,15 @@ index 1d7a4499463026c6b8bd528159c2d5edf300942c..942bfc868423c07d239a1225cf6063ec
? config.ignoreWarnings.map(ignore => {
if (typeof ignore === "function") {
diff --git a/dist/config/zod.js b/dist/config/zod.js
index 028aa93bf7b0b813b3b1b1bab62a3c5176855896..0364b4c91973b1b5a3dee2c64475c022aed969d7 100644
index 9efb9502f22278229c9c5798b7ae5eee2dbd0915..348b9528161995d65d462279f74960d1b00e195f 100644
--- a/dist/config/zod.js
+++ b/dist/config/zod.js
@@ -703,7 +703,8 @@ const profile = zod_1.z.boolean();
//#endregion
//#region Builtins (deprecated)
const builtins = zod_1.z.custom();
-//#endregion
+const features = zod_1.z.custom();
+// #endregion
exports.rspackOptions = zod_1.z.strictObject({
name: name.optional(),
dependencies: dependencies.optional(),
@@ -732,5 +733,6 @@ exports.rspackOptions = zod_1.z.strictObject({
devServer: devServer.optional(),
@@ -759,6 +759,7 @@ exports.rspackOptions = zod_1.z.strictObject({
builtins: builtins.optional(),
module: moduleOptions.optional(),
- profile: profile.optional()
+ profile: profile.optional(),
+ features: features.optional(),
profile: profile.optional(),
- bail: bail.optional()
+ bail: bail.optional(),
+ features: zod_1.z.custom().optional(),
});
//# sourceMappingURL=zod.js.map
Loading

0 comments on commit 420fec8

Please sign in to comment.