Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tile graph with reportDir #641

Merged
merged 1 commit into from
Dec 16, 2024
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
15 changes: 12 additions & 3 deletions packages/core/src/build-utils/build/chunks/generateTileGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type IGenerateReportOpts = {
reportTitle?: string;
bundleDir?: string;
openBrowser?: boolean;
reportDir?: string;
};
async function generateJSONReportUtil(
bundleStats: Plugin.BaseStats,
Expand All @@ -33,14 +34,22 @@ export async function generateTileGraph(
buildOutputPath: string,
) {
try {
const { reportFilename } = opts;
const { reportFilename, reportDir } = opts;
await generateJSONReportUtil(bundleStats, {
...opts,
openBrowser: false,
bundleDir: buildOutputPath,
bundleDir: reportDir || buildOutputPath,
});

return path.join(buildOutputPath, `${reportFilename}`);
return path.join(
reportDir
? path.resolve(
buildOutputPath,
path.relative(buildOutputPath, reportDir),
)
: buildOutputPath,
`${reportFilename}`,
);
} catch (e) {
debug(() => `Generate webpack-bundle-analyzer tile graph has error:${e}`);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const ensureModulesChunksGraphFn = (
ChunksBuildUtils.TileGraphReportName,
),
reportTitle: 'bundle-analyzer',
reportDir: _this.options.reportDir,
},
compiler.outputPath,
);
Expand Down
Loading