Tuesday, 25 April 2017

Laravel Mix breaks package with `npm run dev`

I have a nodejs package written with ES6 functionalities as 'let', the spread operator (...) and default values of a function's arguments.

The thing is when I run npm run production of Laravel Mix, an error shows up, which is the following :

 ERROR  Failed to compile with 1 errors                                 
 error
/js/app.js from UglifyJs
Unexpected token: name (DateTime) [./~/vdatetime/src/datetime.js:3,0]
[/js/app.js:40347,4]

npm ERR! Linux 4.4.0-72-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "production"
npm ERR! node v7.4.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ production: `cross-env NODE_ENV=production 
node_modules/webpack/bin/webpack.js --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2

(Seems to be the let operator that is in cause at line 3)

But when I try npm run dev, everything works as intended. Any idea why it is unable to transpile the code ?



via vTripes

No comments:

Post a Comment