[V1] boot files from "common" directory



  • Hi. I have multiple sub apps in a structure like this:

    + server
    + client
        + _common
            + wish_global_boot_files_were_here
        + quasar_app_1
            + assets
            + boot
            + etc
        + quasar_app_2
        + quasar_app_N
    

    Then I have some boot files that I want to use among the “quasar_app”'s fellows, doing that by placing them on a folder in “_common”.

    How to do it?

    Thanks!



  • What is the purpose of the different apps?

    Scott



  • I have different client versions, some with more some with less features for the same server app.

    Think like if it is an app for enterprise management (this is the server) and I have different clients for different areas of the enterprise, each one seeing very different aspects of the same app, and thus, sharing a lot of technical stuff (like boot files, for example).



  • You can do that all in one app, and should. 😄

    Scott



  • Yes, I know. But there are many reasons to not do, and not all are in my control, you know 😕

    So, no way out from my question: how to share boot files between projects?

    ¯_(ツ)_/¯

    Thanks!



  • Sorry, but I have no idea.

    Scott



  • Well, ok thanks!

    @rstoenescu can you help, please?



  • 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