Tuesday, February 28, 2017

Laravel webpack gives me 0++ in production

On a project using Laravel 5.4 and the new Laravel Mix, I have a weird error when pushing live a website.

When I'm in local, and I run the command npm run dev everything is working perfectly. dev is the following :

"dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"

This command execute webpack (which I am not very familiar with) and convert sass, js, coffe, etc... to vanilla CSS and JS.

The problem is happening when live like I said when the command is npm run production. production is the following :

"production": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"

The traduction is happening correctly but when I go on the website I get the following error :

Uncaught ReferenceError: Invalid left-hand side expression in postfix operation

When I dig a little in the js I find this weird thing happening :

for(var n=t.length;0<n;0++)

So I have 0++ that would need to be n++ and when I make research on the file, I get 115 occurence of the 0++.

I think it is coming from webpack ? a misconfiguration or something ?

Thanks in advance for your help !




via dib258

Advertisement