When I try to compile my webpack build on OSX it gives an weird error but on Windows not, also never occurred.
errored on '{': /* harmony default export */ __webpack_exports__["default"] = class {
If you're using webpack 2, chances are that you have a dependency to some module that has the jsnext:main configuration option to provide its code as ES6 modules. In these cases, webpack 2 uses them, which works fine, until you try to use Uglify, which can't deal with ES6 code.
You're probably excluding your node_modules from Babel loading, as well you should, but for this to work, you need to tell webpack explicitly to include this jsnext:main module.
I had this problem with preact-compat and solved it like this:
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
include: [
path.resolve(__dirname, './src'),
path.resolve(__dirname, './node_modules/preact-compat/src')
]
}
]
}