es6 module - svenberglund/react-mst-grid-layout GitHub Wiki

ES6 moudule

The published module contains ES6 syntax. It is a big advantage in the usage of the module and I expect shipping es6 in node modules to be more common soon. So far however this may cause issues and call for special treatment when making a production build, depending on your build setup. In my test projects so far I have used CRA which does not minify es6 since it in turn OOTB uses uglifyJS.

Ejecting

If you eject the webpack plugin you can use uglifyjs-webpack-plugin. webpack.config:

const Uglify = require("uglifyjs-webpack-plugin");

module.exports = {
    entry: ...,
    output: ...,
    plugins: [
        new Uglify()
    ]
};

reac-app-rewired

Since I used react-app-rewired didn't want to eject, I turned of the minification in my config-overrides.js.

  if (env === 'production') {
    console.log("ES6 production build without UglifyJsPlugin. Config: ");
    console.log(JSON.stringify( config.plugins.splice(3, 1)));
  }

It's a workaround. I might not investigate it further since I consicer using craco in my next project.

We'll see, I might change and ditch this whole thing about publishing es6 alltogeher but it would be a shame.