[V1] boot files from "common" directory



  • Another valid situation: I have a server framework and doing several different apps on same server base, and those apps share some boot files that embed common framework logic and each one still have some exclusive boot files that is individual app logic.

    I suggest that quasar should look for a folder “common” (this name should be configured in quasar.conf) one path up from the project folder, and if it is founded, folders with same name than the ones created on the project folder should be used / recognized.

    + server
    - client
        - _common        //  or "global" or "global_src"
            + boot       // recognised: global boot files
            + assets     // recognised: global assets files
            + my_folder  // ignored OR could be used for imports
        - quasar_app_1
            - src
                + assets
                + boot
                + etc
        + quasar_app_2
        + quasar_app_N
    


  • I suggest using boot files to import your “common boot files”



  • @Hawkeye64 - What about builds? Would that idea still work? Does the build system take anything into account outside the /src folder, which btw, @labs20 you are missing in your example folder hierarchy.

    Scott



  • @s-molinari said in [V1] boot files from "common" directory:

    /src folder, which btw, @labs20 you are missing in your example folder hierarchy.

    Scott

    uops!! fixed 🙂


  • Admin

    @labs20 Hi,

    Nothing stopping you from specifying boot files with relative path to the /boot (example: ‘…/…/some/common/folder’). Just make sure that you add that containing folder to quasar.conf.js > build > transpileDependencies. More info: Quasar CLI > quasar.conf.js.



  • hummm… ok!

    Should had tried that before.

    Thanks.



  • Hi, @rstoenescu!

    Well, it didn’t worked.

    I’ve tried:

            boot: [
                '../_common/boot/handler.js'
            ],
            ...
            transpileDependencies: [
                '../_common/boot',
            ]
    

    and:

            boot: [
                '../_common/boot/handler.js'
            ],
            ...
            transpileDependencies: [
                '../_common/boot/',
            ]
    

    and:

            boot: [
                '../_common/boot/handler.js'
            ],
            ...
            transpileDependencies: [
                '../_common/boot/handler.js',
            ]
    

    but none worked.

    The error is:

     app:dev-server Booting up... +3ms
    
     app:progress Compiling SPA... +163ms
     app:progress Compiled SPA in ~14s +14s
     ERROR  Failed to compile with 1 errors10:07:58 AM
    
    This dependency was not found:
    
    * boot/../_common/boot/handler.js in ./.quasar/client-entry.js
    
    To install it, you can run: npm install --save boot/../_common/boot/handler.js
    
    

    Any help?



  • I think the idea is to use the boot file to import your external common files. Quasar is only looking for a file name (string) for the file in the boot folder.

    Scott


  • Admin

    @labs20 ‘…/_common’ means it resolves to ‘client/quasar_app_1/src’
    Your path should be ‘…/…/…/_common/…’



  • @rstoenescu said in [V1] boot files from "common" directory:

    @labs20 ‘…/_common’ means it resolves to ‘client/quasar_app_1/src’
    Your path should be ‘…/…/…/_common/…’

    Yeap! Working like a charm. My bad!

    Thank you!



  • I learned something too. 😁

    Scott


Log in to reply