Simple Question: How to pass 'buildDir' and 'showProgress' on commandline



  • Hi,

    We’d like to pass in the ‘buildDir’ and ‘showProgress’ values from the commandline into the build section of quasar.conf.js

    For example,

    We’d like to do this:

    WEB_BUILD_DIR=/someBuildDir
    WEB_BUILD_SHOW_PROGRESS=false
    

    and then run quasar build and have it NOT show the progress bar and build to the output directory we specify.

    AND… if either of those values are not present then default to their default values.

    I’m tried this in the build section of quasar.conf.js and I have partial luck. I don’t know how to tell the script to use default values IF those. values are not present on the command line or process.env. Javascript/Web UI isn’t my strong point. I’m a backend developer by trade.

    // quasar.conf.js

    {
    
    build: {
          distDir: process.env.WEB_BUILD_DIR,
          showProgress: process.env.WEB_BUILD_SHOW_PROGRESS,
          scopeHoisting: true,
         ... // rest of config
        },
    }
    

    Thanks…



  • @tmulle Did you try to use || operator ?

    {
    
    build: {
          distDir: process.env.WEB_BUILD_DIR || 'default/dist/dir',
          showProgress: process.env.WEB_BUILD_SHOW_PROGRESS || true,
          scopeHoisting: true,
         ... // rest of config
        },
    }
    

Log in to reply