sambernard / react-preload

Component to preload images before showing content
MIT License
148 stars 48 forks source link

Failed to minify ImageHelper.js #32

Open Bradley-Morris opened 6 years ago

Bradley-Morris commented 6 years ago

I'm using the Preload package in my app , I use webpack to bundle and minify everything using the HtmlWebpackPlugin with minifyjs set to true. When I build the project with this package installed I get the following error:

Failed to minify the code from this file:

    ./node_modules/react-preload/lib/ImageHelper.js:3

Any hints as to how I could solve this?

It appears that it isn't transpiled to ES5. According to the following link:

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify

I'll try create a transpiled version.

sambernard commented 6 years ago

Just got back from being off the grid for 10 days!

I'll take a look- do you have a sample minimal test case I could use to reproduce this? My gut tells me that I'm probably transpiling down to es6 instead of es5.

kechstart commented 5 years ago

+1 I am facing the same error on production build with create-react-app boilerplate. Can you suggest any solution. Youur lib is good shot but anyway i am facing this issue.

sambernard commented 5 years ago

@kechstart can you put together a test case so I can reproduce?

josephmallari commented 5 years ago

@kechstart @sambernard I had this issue on CRA. But I updated my react-scripts to 2.0 or higher and it solved the problem.