Mix compiling assets to the wrong directory after modifying the file structure of Laravel
Hello,
Due to limitations in my hosting service, I had to change the folder structure of my Laravel application. The current structure is as follows:
css/
images/
js/
storage (this is a symlink)
system/
.htaccess
.favicon.ico
index.php
mix-manifest.json
robots.txt
I have basically made the public directory as the root directory and moved everything else into the system directory. I have modified the paths in the index.php file and the app works as intended now. The problem arises when I try to compile my js and css assets using npm run watch. I have modified the webpack.mix.js file (for me which is inside system directory) to have the proper output paths.
Original webpack.mix.js file:
mix.sass('resources/assets/sass/app.scss', './public/css')
.js('resources/assets/js/app.js', './public/js');
Modified webpack.mix.js file:
mix.sass('resources/assets/sass/app.scss', './../css')
.js('resources/assets/js/app.js', './../js');
But when I run npm run watch, the files are compiled into system/public/home/user/projects/laravel/system/public/ folder. It adds the absolute path to the js and css folders. Why is this happening and how can I fix it?
Thanks, Tamrat
Please or to participate in this conversation.