-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Why my code is not minified on production? I can see my entire React code #23216
Comments
@Steffi3rd what command did you run to build your site? |
To build :
But I'm talking about React code for not normal users but (dev) users who are looking JS. IMO, in production, React code shouldn't visible as the same as I see it in VS Code... Do you understand what I mean or it's not a big deal? Because by seeing the screenshot below, (dev) users can see thee entire structure of my React projects. |
Or the solution is to not use |
@Steffi3rd can you send you your site to me? Perhaps over email ? ward@gatsbyjs.com |
@wardpeet Yes, done. Let me know. Thank you 🙏 |
I've looked at your code and everything is minified correctly. The reason why you see the code is because of sourcemaps. It's only used when having devtools open, it has no performance downside. If you want to look how your code actually looks like you can disable source-maps using devtools settings: Thank you for opening this, @Steffi3rd We're marking this issue as answered and closing it for now but please feel free to reopen this and comment if you would like to continue this discussion. We hope we managed to help and thank you for using Gatsby! 💜 |
Yes, thank you Ward I understand now. I just found some issues about my issue :
I even found a plugin that solve my problem : 🙏 |
sourcemaps are a great way to find issues with your bundle. There is no harm in exposing them. If you feel like you rather not generate them, that's cool. |
I've tried the above solutions but none worked so far.
I've tried to dump the webpack configuration and found this:
Apparently sourceMap keeps enabled in this section for some reason.
Any idea of why this is happening? |
I'm going to add a quick update, the files that I was trying to remove the sourceMap are from |
Summary
I just realized that my files are entire visible when console.log is display. (Yeah it was a mistake for the log) but even that, IMO it doesn't seem good to see my entire React code not minified.
Is that normal ?
Do I miss an option when building?
In case it's normal, how to minife/hide that?
Relevant information
Here is a screenshot for production.
Accessible via Chrome > Source.
Environment (if relevant)
File contents (if changed)
gatsby-config.js
: N/Apackage.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/AThe text was updated successfully, but these errors were encountered: