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

Create a development and a production build #823

Open
onigoetz opened this issue Apr 17, 2018 · 1 comment
Open

Create a development and a production build #823

onigoetz opened this issue Apr 17, 2018 · 1 comment

Comments

@onigoetz
Copy link

onigoetz commented Apr 17, 2018

There are a lot of checks all over the place for example :

validateParameterPresence( unit, "unit" );
validateParameterTypeString( unit, "unit" );

Are they useful in production ?

In the source code of React, there are a lot of checks but they are enabled only in development mode :

For example : https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ReactDOM.js#L1053-L1055

And they change this variable when building : https://github.com/facebook/react/blob/master/scripts/rollup/build.js#L234
They even have babel plugins to automatically wrap some functions with this if (__DEV__) {} condition : https://github.com/facebook/react/blob/master/scripts/rollup/build.js#L88-L91

This could have two advantages :

  • The size of the final bundle would be smaller
  • The performance would be better by not running those checks

Is it possible to have something similar in Globalize ?

If yes, I'm willing to do a POC Pull Request

Edit :
I know there is a runtime version already, but not everybody can use the production generator to be able to use only the Globalize Runtime, Anyway, these changes would also benefit the runtime version

@rxaviers
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants