Laravel mix takes a lot of time to run npm run prod on the production server. I don't want to make the server wait that much. So to avoid that, I mix it on dev using npm run dev and push the mixed files in my project repository. When I update the code in the production , I don't need to mix that again using this process.
But I am unable to get the minified files this way.
So what could be the best approach to get the minifiied files in much lesser time ? Assuming we are not running the npm run prod on the server.
Using Github and forge.
Any help would be appreciated.
ERROR Failed to compile with 4 errors 15:33:18
error
/dist/js/file-1.js from UglifyJs
Unexpected token: name (template) [./node_modules/vue-read-more/components/ReadMoreComponent.js:1,0][/dist/js/file-1.js:84223,4]
error
/dist/js/file-2.js from UglifyJs
Unexpected token: name (template) [./node_modules/vue-read-more/components/ReadMoreComponent.js:1,0][/dist/js/file-2.js:84410,4]
error
/dist/js/file-3.js from UglifyJs
Unexpected token: name (template) [./node_modules/vue-read-more/components/ReadMoreComponent.js:1,0][/dist/js/file-3.js:67381,4]
error
/dist/js/file-4.js from UglifyJs
Unexpected token: name (template) [./node_modules/vue-read-more/components/ReadMoreComponent.js:1,0][/dist/js/file-4.js:37365,4]
Whoops! We had trouble minifying "public/dist/js/file-1.js". Perhaps you need to use mix.babel() instead?
/home/himanshu/Projects/laravel_project/node_modules/laravel-mix/src/plugins/CustomTasksPlugin.js:66
throw e;
^
SyntaxError: Unexpected token: name (i)
at JS_Parse_Error.get (eval at <anonymous> (/home/himanshu/Projects/laravel_project/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:86:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/himanshu/.npm/_logs/2018-06-29T10_03_27_175Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ prod: `npm run production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/himanshu/.npm/_logs/2018-06-29T10_03_27_225Z-debug.log