Part of my code doesn’t seem to pass through Babel before arriving at Uglify

Asked

Viewed 44 times

4

I’m not managing to generate the production build of my application with Laravel Mix. When trying to generate the build npm tells me there was an error trying to run Uglifyjs:

/js/app.js from Uglifyjs
Unexpected token: Operator (>) [./~/bootstrap/js/src/modal.js:11,0][/js/app.js:34863,20]

I went to look at the code and on line 11 of modal.js (from bootstrap 4 alpha, which I am importing by component as needed) has a Arrow Function. It is she who is causing the error. If I withdraw the import of modal.js, the complete build normally.

My diagnosis is that this file is not going through Babel before it reaches Uglify. This seems to me very strange, since the rest of my code seems to be going through Babel normally.

My webpack.mix.js is the default:

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');

I don’t have much experience with Laravel Mix, and I am far from deciphering all the mysteries of the webpack... Does anyone know why this is happening, and how to solve?

  • PS: there are some references to similar errors in Laravel Mix’s Github, but none of the solutions indicated there worked for me.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.