I’m one of those guys that searchs the web for a built package.json and uses it for everything. And I’m loving sage 9.
On my company, we also use Laravel a lot and I’m trying to push sage 9 out of WP and to the whole team.
I was able to make a simple repo for vanilla php, just removed all the WP php, added a few functions of my own and edited the some config.json file. And it was awesome, the level of configuration Sage 9 brings is out of this world.
For Laravel, I’m having a bit more trouble and I’m not sure if this is a bug or just little knowledge on my part.
The problem is the folder structure. Laravel has its assets under ROOT/resources/assets and the dist should be under ROOT/public/dist.
I was able to hack my way into making it work by putting sage 9 this way:
- On package.json, I edited the scripts to point to resources/assets/build/webpack.config.js. No problem here.
- Edited the config.json:
However when “npm run build” I kept getting module not found errors. After much trial, error and webpack docs I was able to make it work by changing all the loaders includes to:
include: [path.resolve(config.paths.root, config.paths.assets), config.paths.root],
(assets path had to be full)
My questions are:
Am I doing something wrong? Is there a simple way to configure Sage 9 for this to work almost out of the box?
Is Sage 9 supposed to work under different folders then /assets, /dist. Specifically under different parent folders like /folder1/assets → folder2/dist?
Is this something Sage 9 (webpack part only) would like to evolve to (A multi framework tool)?