envoyer-npm-deployment
envoyer-npm-deployment copied to clipboard
npm run production fails
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
Thank you very much @repat - exactly what I needed!
@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.