envoyer-npm-deployment icon indicating copy to clipboard operation
envoyer-npm-deployment copied to clipboard

npm run production fails

Open repat opened this issue 7 years ago • 2 comments

webpack.config.js:

require('./node_modules/laravel-mix/src/index');
Mix.paths.setRootPath(path.resolve(__dirname));
module.exports = require('laravel-mix/setup/webpack.config.js');

Problem is the rootPath, so create this file above in the root of your project and change package.json to:

cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=webpack.config.js // <-- change --config

What it does is setting the rootPath relative to where you're running the command (__dirname) from and then loading the config file. Otherwise the config file has the wrong paths set and the whole process fails.

Maybe this helps someone

repat avatar Aug 27 '18 15:08 repat

Thank you very much @repat - exactly what I needed!

CBreetzi avatar Feb 06 '19 01:02 CBreetzi

@repat Thank you!, also you don't need the hooks in this repo with your method. you can just add a linked folder node_modules -> node_modules in the Deployment hooks tab.

jbreuer95 avatar Mar 30 '19 12:03 jbreuer95