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

Allow stripping of error messages and warnings in production #556

Closed
wants to merge 1 commit into from
Closed

Allow stripping of error messages and warnings in production #556

wants to merge 1 commit into from

Conversation

agundermann
Copy link
Contributor

Fixes #545

Hope I didn't miss anything ;)

@mjackson
Copy link
Member

mjackson commented Dec 3, 2014

Thanks @taurose !

I'm trying to think of what the best strategy is here. e.g. the React project uses envify to translate blocks like

if (process.env.NODE_ENV !== 'production') {
  warning( ... );
}

to

if ('development' !== 'production') {
  warning( ... );
}

In this situation, a tool like uglify can come along and strip out the portions of dead code easily, reducing the overall size of the build.

I'd love to take a similar approach in react-router. Do you think you'd be up for it? It would require not only changes to the code, but some tweaks to our build process as well.

@agundermann
Copy link
Contributor Author

I'm not sure I understand your comment. What you mentioned is already possible with these changes, and scripts/build is able to eliminate the dead code as is. Reported size went from 12943 bytes to 12444.

Since you mentioned build process, I realized only now that facebook has an AST transformation step (https://github.com/facebook/react/blob/master/vendor/constants.js). Is that what you're asking for?

@mjackson
Copy link
Member

mjackson commented Dec 3, 2014

scripts/build is able to eliminate the dead code as is

Oh, I didn't realize that ;) Thanks for pointing that out. I'll take a closer look.

@agundermann
Copy link
Contributor Author

Closing this since I think integrating this in the build process would be a better solution.
Feel free to reopen if there's interest after all.

@agundermann agundermann closed this Jan 9, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow stripping of error messages and warnings in production?
2 participants