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

Option to change the output directory #185

Closed
Chris2011 opened this issue May 23, 2018 · 4 comments
Closed

Option to change the output directory #185

Chris2011 opened this issue May 23, 2018 · 4 comments

Comments

@Chris2011
Copy link

Chris2011 commented May 23, 2018

Issue description

I want to create a new folder called reports, which should not be part of the output.path of the webpack bundle. It should be a separate path, that I can choose with an option, to generate the stats.json file there.

Technical info

  • Webpack Bundle Analyzer version: 2.13.1
  • Webpack version: 3.6.0
  • Node.js version: 8.9.4
  • npm/yarn version: 5.6.0
  • OS: Windows 10 (64 Bit)

Debug info

How do you use this module? As CLI utility or as plugin?
As a plugin, with options

If CLI, what command was used? (e.g. webpack-bundle-analyzer -O path/to/stats.json)
webpack-bundle-analyzer ./dist/stats.json (Only for reading the generated file with a custom npm script.)

If plugin, what options were provided? (e.g. new BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true }))

{
   generateStatsFile: true,
   analyzerMode: 'static',
   openAnalyzer: false
}

What other Webpack plugins were used?
CopyWebpackPlugin
SpriteLoaderPlugin

It would be nice to also attach webpack stats file.
It can be generated using these options:

new BundleAnalyzerPlugin({
  analyzerMode: 'disabled',
  generateStatsFile: true,
  // Excludes module sources from stats file so there won't be any sensitive data
  statsOptions: { source: false }
})`

stats.json will be created in Webpack bundle output directory.

@valscion
Copy link
Member

Did you try using statsFilename: '../../some/other/dir/stats.json way? The path is relative to the build output directory, but I think you can traverse from there to another directory.

@valscion
Copy link
Member

You can also pass an absolute filepath for statsFilename option to generate the stats.json to any directory.

@valscion
Copy link
Member

Let me know if these solutions work for you, or if you have additional questions. I'm going to close this issue for now as I think we already support what you're asking ☺️

@Chris2011
Copy link
Author

Thx, it is working as expected. It wasn't clear. I should have test it before. Thx.

leonascimento added a commit to leonascimento/webpack-bundle-analyzer that referenced this issue Sep 13, 2018
This pull request should add that we can be able to
define the absolute paths to generate the statsFileName or
reportFileName.

Relates to webpack-contrib#186 webpack-contrib#185
leonascimento added a commit to leonascimento/webpack-bundle-analyzer that referenced this issue Sep 18, 2018
This pull request should add that we can be able to
define the absolute paths to generate the statsFileName or
reportFileName.

Relates to webpack-contrib#186 webpack-contrib#185
leonascimento added a commit to leonascimento/webpack-bundle-analyzer that referenced this issue Sep 20, 2018
This pull request should add that we can be able to
define the absolute paths to generate the statsFileName or
reportFileName.

Relates to webpack-contrib#186 webpack-contrib#185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants