Skip to content

Commit

Permalink
feat: add --config-loader CLI option (#9210)
Browse files Browse the repository at this point in the history
* feat: disable-interpret CLI option

* feat: disable-interpret CLI option replaced by config-loader

* feat: config-loader behavior fixed
  • Loading branch information
krutoo authored Feb 11, 2025
1 parent c1e945f commit 3fa4f3e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/rspack-cli/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface RspackCLIOptions {
config?: string;
argv?: Record<string, any>;
configName?: string[];
"config-loader"?: string;
}

export interface RspackBuildCLIOptions extends RspackCLIOptions {
Expand Down
4 changes: 2 additions & 2 deletions packages/rspack-cli/src/utils/loadConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ export async function loadRspackConfig(
if (!fs.existsSync(configPath)) {
throw new Error(`config file "${configPath}" not found.`);
}
if (isTsFile(configPath)) {
if (isTsFile(configPath) && options["config-loader"] === "register") {
await registerLoader(configPath);
}
return crossImport(configPath, cwd);
}

const defaultConfig = findConfig(path.resolve(cwd, DEFAULT_CONFIG_NAME));
if (defaultConfig) {
if (isTsFile(defaultConfig)) {
if (isTsFile(defaultConfig) && options["config-loader"] === "register") {
await registerLoader(defaultConfig);
}
return crossImport(defaultConfig, cwd);
Expand Down
6 changes: 6 additions & 0 deletions packages/rspack-cli/src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export const commonOptions = (yargs: yargs.Argv) => {
type: "array",
string: true,
describe: "Name of the configuration to use."
},
"config-loader": {
type: "string",
default: "register",
describe:
"Specify the loader to load the config file, can be `native` or `register`."
}
})
.alias({ v: "version", h: "help" });
Expand Down

2 comments on commit 3fa4f3e

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on 3fa4f3e Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ecosystem CI detail: Open

suite result
modernjs ❌ failure
rspress ✅ success
rslib ✅ success
rsbuild ❌ failure
rsdoctor ❌ failure
examples ✅ success
devserver ✅ success
nuxt ✅ success

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on 3fa4f3e Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2025-02-11 9d82335) Current Change
10000_big_production-mode_disable-minimize + exec 37.7 s ± 637 ms 39.1 s ± 1.12 s +3.77 %
10000_development-mode + exec 1.88 s ± 89 ms 1.87 s ± 58 ms -0.62 %
10000_development-mode_hmr + exec 685 ms ± 7.4 ms 687 ms ± 5 ms +0.28 %
10000_production-mode + exec 2.28 s ± 51 ms 2.28 s ± 67 ms +0.06 %
10000_production-mode_persistent-cold + exec 2.47 s ± 72 ms 2.45 s ± 85 ms -0.58 %
10000_production-mode_persistent-hot + exec 1.65 s ± 61 ms 1.66 s ± 26 ms +0.72 %
arco-pro_development-mode + exec 1.78 s ± 145 ms 1.78 s ± 137 ms +0.32 %
arco-pro_development-mode_hmr + exec 389 ms ± 2.1 ms 388 ms ± 3.3 ms -0.19 %
arco-pro_production-mode + exec 3.59 s ± 217 ms 3.71 s ± 102 ms +3.43 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.72 s ± 229 ms 3.67 s ± 63 ms -1.33 %
arco-pro_production-mode_persistent-cold + exec 3.85 s ± 164 ms 3.78 s ± 162 ms -1.79 %
arco-pro_production-mode_persistent-hot + exec 2.36 s ± 99 ms 2.41 s ± 227 ms +2.34 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.63 s ± 69 ms 3.63 s ± 267 ms -0.10 %
large-dyn-imports_development-mode + exec 2.09 s ± 24 ms 2.12 s ± 137 ms +1.18 %
large-dyn-imports_production-mode + exec 2.15 s ± 71 ms 2.15 s ± 47 ms +0.08 %
threejs_development-mode_10x + exec 1.54 s ± 25 ms 1.55 s ± 44 ms +0.92 %
threejs_development-mode_10x_hmr + exec 779 ms ± 7 ms 787 ms ± 18 ms +1.06 %
threejs_production-mode_10x + exec 5.2 s ± 32 ms 5.26 s ± 174 ms +1.21 %
threejs_production-mode_10x_persistent-cold + exec 5.27 s ± 65 ms 5.38 s ± 266 ms +1.93 %
threejs_production-mode_10x_persistent-hot + exec 4.53 s ± 220 ms 4.63 s ± 233 ms +2.15 %
10000_big_production-mode_disable-minimize + rss memory 8706 MiB ± 32.4 MiB 8710 MiB ± 54 MiB +0.05 %
10000_development-mode + rss memory 649 MiB ± 12.6 MiB 675 MiB ± 57.1 MiB +4.03 %
10000_development-mode_hmr + rss memory 1344 MiB ± 112 MiB 1252 MiB ± 156 MiB -6.88 %
10000_production-mode + rss memory 621 MiB ± 21.8 MiB 643 MiB ± 26.4 MiB +3.69 %
10000_production-mode_persistent-cold + rss memory 746 MiB ± 24.7 MiB 765 MiB ± 24.4 MiB +2.43 %
10000_production-mode_persistent-hot + rss memory 717 MiB ± 23.3 MiB 756 MiB ± 24.4 MiB +5.51 %
arco-pro_development-mode + rss memory 569 MiB ± 17.5 MiB 588 MiB ± 28.5 MiB +3.37 %
arco-pro_development-mode_hmr + rss memory 643 MiB ± 49.1 MiB 675 MiB ± 81.8 MiB +4.97 %
arco-pro_production-mode + rss memory 714 MiB ± 28.8 MiB 716 MiB ± 34.8 MiB +0.34 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 732 MiB ± 22.4 MiB 723 MiB ± 23 MiB -1.25 %
arco-pro_production-mode_persistent-cold + rss memory 853 MiB ± 45.5 MiB 841 MiB ± 37.8 MiB -1.43 %
arco-pro_production-mode_persistent-hot + rss memory 708 MiB ± 27.8 MiB 721 MiB ± 19.5 MiB +1.90 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 727 MiB ± 48.2 MiB 728 MiB ± 52 MiB +0.07 %
large-dyn-imports_development-mode + rss memory 644 MiB ± 5.26 MiB 642 MiB ± 5.71 MiB -0.27 %
large-dyn-imports_production-mode + rss memory 526 MiB ± 7.84 MiB 528 MiB ± 5.41 MiB +0.30 %
threejs_development-mode_10x + rss memory 553 MiB ± 16.3 MiB 547 MiB ± 14.1 MiB -1.07 %
threejs_development-mode_10x_hmr + rss memory 1145 MiB ± 140 MiB 1153 MiB ± 94.8 MiB +0.72 %
threejs_production-mode_10x + rss memory 828 MiB ± 50.8 MiB 821 MiB ± 24.4 MiB -0.86 %
threejs_production-mode_10x_persistent-cold + rss memory 960 MiB ± 14.5 MiB 936 MiB ± 53.7 MiB -2.48 %
threejs_production-mode_10x_persistent-hot + rss memory 877 MiB ± 54.8 MiB 851 MiB ± 41.9 MiB -3.05 %

Please sign in to comment.