Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/build-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@rsbuild/plugin-sass": "^1.5.2",
"@rsbuild/plugin-svgr": "^2.0.2",
"@rsbuild/plugin-type-check": "^1.3.4",
"@rsdoctor/rspack-plugin": "^1.5.11",
"@rslib/core": "^0.21.5",
"@rspack/core": "^2.0.4",
"@swc/plugin-emotion": "^14.10.0",
Expand Down Expand Up @@ -68,7 +69,8 @@
"bufferutil",
"utf-8-validate",
"css-loader",
"url-loader"
"url-loader",
"@rsdoctor/rspack-plugin"
]
}
},
Expand Down
20 changes: 18 additions & 2 deletions packages/cli-core/src/features/BuildCommand/BuildCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { IBaseAppParams } from "~/abstractions/features/types.js";
import { BuildRunner } from "~/features/BuildCommand/buildRunners/BuildRunner.js";
import { createBaseAppOptions } from "~/features/common/index.js";

export type IBuildCommandParams = IBaseAppParams;
export interface IBuildCommandParams extends IBaseAppParams {
analyze?: boolean;
}

export class BuildCommand implements CliCommandFactory.Interface<IBuildCommandParams> {
constructor(
Expand All @@ -33,8 +35,22 @@ export class BuildCommand implements CliCommandFactory.Interface<IBuildCommandPa
required: true
}
],
options: createBaseAppOptions(projectSdk),
options: [
...createBaseAppOptions(projectSdk),
{
name: "analyze",
description: "Run bundle analysis during build",
type: "boolean"
}
],
handler: async (params: IBuildCommandParams) => {
if (params.analyze) {
// Set directly on process.env so forked build processes
// (RunnableBuildProcess) inherit it automatically via { ...process.env }.
// rsbuild detects RSDOCTOR=true and enables bundle analysis natively.
process.env.RSDOCTOR = "true";
}

const stdio = this.stdioService;
const ui = this.ui;

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/files/references.json

Large diffs are not rendered by default.

Loading
Loading