Undestanding package modification procedure
-
Hello,
I see a lot of questions about bagisto customization. But no very clear documentation.
I would like to modify the code of the "Ui" package. Not only the published files but the core of the package.
The problem is that once the modifications are done, no effect is visible. (Because the published files override it I guess).
From what I understand, here is the procedure:
- Make changes in a package
- Run the npm run dev command (in the package) to compile the files in the "publishable" folder.
- Run the command "php artisan bagisto:publish" to publish all files of "publishable" folder to the /public folder.
The problem is that at step 2, the npm run dev command returns this error:
> npm run development > development > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js The specified path cannot be found. Error: spawn node_modules\webpack\binwebpack.js ENOENT at notFoundError (C:\wamp64\www\BagistoCustom\node_modules\cross-spawn\lib\enoent.js:6:26) at verifyENOENT (C:\wamp64\www\BagistoCustom\node_modules\cross-spawn\lib\enoen at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) Emitted 'error' event on ChildProcess instance at: at ChildProcess.cp.emit (C:\wamp64\www\BagistoCustom\node_modules\cross-spawn\l errno: 'ENOENT', syscall: 'spawn node_modules\webpack\bin\webpack.js', path: 'node_modules\webpack\bin\webpack.js', spawnargs: [ '--progress', '--hide-modules', '--config=node_modules/laravel-mix/setup/webpack.config.js' ] }
Question 1 : I guess it is because npm is not installed inside the package. But do I really have to run "npm i" in all packages that I will modify?
Question 2 : And finally, is it possible to configure Bagisto to always fetch files from packages and not from published files? (So we could make some modifications without the need of run all of these commands every time).
Question 3 : In the webpack.mix.js files of each packages, there is this code :
if (mix.inProduction()) { var publicPath = 'publishable/assets'; } else { var publicPath = "../../../public/vendor/webkul/ui/assets"; }
Does this mean that changes made only in published files will have no effect in production?
Could someone confirm that my "procedure" is correct and answer these three questions?
Thanks a lot!
-
Hi there,
For Question 1: you need to run npm commands for all package in which you are doing the changes.Qurstion 2. : For this you can run npm run watch command inside the package in which you are doing the change, and after completing the code you can run npm run prod
Question 3 : yes,changes made on published files will effect in production
-
You can use php artisan vendor:publish --force also.