Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Undestanding package modification procedure

    General Discussion
    4
    4
    293
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MallauryG last edited by MallauryG

      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:

      1. Make changes in a package
      2. Run the npm run dev command (in the package) to compile the files in the "publishable" folder.
      3. 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!

      1 Reply Last reply Reply Quote 0
      • sanjay-webkul
        sanjay-webkul last edited by

        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

        1 Reply Last reply Reply Quote 0
        • diverti
          diverti last edited by

          You can use php artisan vendor:publish --force also.

          1 Reply Last reply Reply Quote 0
          • A
            Amitk-Webkul last edited by

            Hi @MallauryG,

            Yes, You can do the same.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post