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

Support output.path interpolation #304

Closed
wants to merge 1 commit into from

Conversation

valscion
Copy link
Member

Resolves #297

Copy link
Member Author

@valscion valscion left a comment

Choose a reason for hiding this comment

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

This is a first draft pass on how one could resolve #297. I don't have more time to look into this, but if @th0r you feel like taking over from here and have an idea on how to do this, be my guest ☺️

@@ -35,6 +35,7 @@ class BundleAnalyzerPlugin {

const done = (stats, callback) => {
callback = callback || (() => {});
const bundleDir = stats.compilation.getPath(stats.compilation.outputOptions.path);
Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea if this getPath function is a public API from webpack. And neither do I know if stats.compilation.outputOptions.path is OK to use here.


await webpackCompile(config);

const chartData = await getChartDataFromReport('7e56a1f8a54acedcc9ce/report.html');
Copy link
Member Author

@valscion valscion Jul 30, 2019

Choose a reason for hiding this comment

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

I'm not sure if this hash is the same across different webpack versions... this might cause a very brittle test.

I don't yet have good ideas on how to figure out the hash that was used to get to the report page.

} else if (this.opts.analyzerMode === 'static') {
actions.push(() => this.generateStaticReport(stats.toJson()));
actions.push(() => this.generateStaticReport(stats.toJson(), bundleDir));
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not a huge fan in how I had to add another argument to these methods to get this working

@valscion valscion closed this Feb 13, 2023
@valscion valscion deleted the output-path-with-interpolation branch February 13, 2023 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No Parsed/Gziped sizes if there is build hash in output path
1 participant