globalize icon indicating copy to clipboard operation
globalize copied to clipboard

Create a development and a production build

Open onigoetz opened this issue 6 years ago • 1 comments

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

onigoetz avatar Apr 17 '18 09:04 onigoetz

:+1:

rxaviers avatar Apr 17 '18 18:04 rxaviers