Gatsby: Remove webpack.stats.json from production build

Created on 30 Apr 2020  路  9Comments  路  Source: gatsbyjs/gatsby

Summary

Could we have an option to remove all files from the build directory that is not necessary for the final working site?

Basic example

It seems like webpack.stats.json is not needed. Are some of the other *.js files also not needed for a functioning website.

Motivation

I would like to have minimal output and not have any unecessary files. Also, some files like webpack.stats.json leak some internal info about the source files. It would be cleaner to have only the minimal set of files in the final build output directory.

breaking change stale? webpacbabel feature or enhancement

Most helpful comment

Files like webpack.stats.json being deployed can cause false positives for information exposure in automated security scanners, so having a clean way to address this without custom intervention by end-users would be good.

All 9 comments

It seems like webpack.stats.json is not needed.

Right now this file is used by various plugins, but we could remove it just before the finishing the build

Are some of the other *.js files also not needed for a functioning website.

What other *.js files do you mean here? I know that there is another .json file (chunks-map?) that could use similar treatment.

I don't know enough about the internals to know what's used, but if I were treating it as a black box, I'd just try removing every file and see if the site still works. If it does, then we can remove that file. "manifest.webmanifest" is another one if you don't care about PWA. Maybe "chunk-map.json", but I don't know what that does.

This request might be some post-build step that cleans up the output directory.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

I still think this would be useful.

I agree there is no need to upload this file. Let's put it in the .cache folder in a major release. I don't think that this is a big deal, to be honest.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.
Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 馃挭馃挏

Bump. Not stale.

Files like webpack.stats.json being deployed can cause false positives for information exposure in automated security scanners, so having a clean way to address this without custom intervention by end-users would be good.

Was this page helpful?
0 / 5 - 0 ratings