Minifying problem with create-react-app build
opened this issue · comments
Thanks for this really useful library!
My project was created from FB create-react-app
. When trying to prepare the production bundle the build step fails due to minifying issue with js-lru. I'm quoting their explanation for the error:
Some third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.
# npm run build
...
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/lru_map/lru.js:85
Read more here: http://bit.ly/2tRViJ9
Same here with webpack v3.8.1
:
ERROR in yappy.min.js from UglifyJs
Unexpected token: name (entry) [./node_modules/lru_map/lru.js:85,0][yappy.min.js:111219,6]
Is there a workaround?
UPD
Got it working by telling babel
to transpile node_modules/lru_map
. Loader example in case anyone needs it:
{
test: /\.js(x)?$/,
loader: 'babel-loader',
include: [
...
path.resolve(__dirname, 'node_modules/lru_map'),
]
}