The official docs for React describe how to generate a production build with webpack using UglifyJS plugin and how to validate that one really is using the production build in a browser. However, I'm using NodeJS 7.x (and hopefully will switch to 8.x soon) and I'm using Babel preset-env
, because I don't want to compile ES6 features supported already by NodeJS (e.g. async/await) to ES5. Thus, I can't use UglifyJS plugin, because it doesn't work with ES6 code yet. I tried switching to Babili, but its default preset does some unsafe transformations (see https://github.com/babel/babili/issues/570) that cause my code to break. I can modify the preset to use only safe transformation, but the thing is that I'm not really interested in minifying the code, as it will be executed only on the server; I'm only interested in removing dead code that might eventually slow down the server.
So what's better? Is it better to use a minifier like Babili and configure it to only remove dead code using safe transformations, or maybe it's better to use Webpack Resolve#alias
to load production build of React from dist
folder?
via szimek
No comments:
Post a Comment