-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
chore: drop console.log from production builds #1012
Conversation
all_frames: booleanSchema, | ||
world: { | ||
type: "string", | ||
enum: ["MAIN", "ISOLATED"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flexchar - might need to double check if this is available on Firefox yet. If not, let's add this, but also keep the old behavior for cross-browser compatibility I think :-?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually would be best to do the drop console in a separate PR to merge quickly, then we can do the main world fix later :-?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow wat?... so compress: true
only doesn't drop the console?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's not under the defaults. I included the link to the docs :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff needs to be a isolated to what it's trying to do.
I don't particularly agree with this change: there are valid reasons to want logs in prod build. The way to usually deal with it is to have a logging utility where you choose which level of logs you want to keep in prod build based on a variable in |
@mathieudutour that's a good point, that's why I added an open question to my PR. Ideally i would like to support It could also be a CLI option but it feels wrong. It feels that something like this should live in a dedicated config file. |
Hmm @flexchar yeah I think most sane solution would be to suggest end-user to leverage env vars. Parcel prunes dead branches. Thus:
Will be pruned if it's production |
Oh, I didn't know this existed. I did have simple function I am definitely less experienced in the context of custom parcel + swc. Do you think there is a relatively easy way to provide config file? |
Details
This PR enables
drop_console
option inswc
minifier.I tried to add support for custom
.swcrc
but I couldn't get it work in any way. It would be amazing if people could configure that. But I also think it's ok to not have console log in production. What do you think?Options docs: https://swc.rs/docs/usage/core#options
Compress docs: https://swc.rs/docs/configuration/minification#jscminifycompress
Related: #542
Code of Conduct
Contacts
If your PR is accepted, we will award you with the
Contributor
role on Discord server.To join the server, visit: https://www.plasmo.com/s/d