How to pass information to build process



  • I have what may be an unusual situation. In my Quasar based app, I have a constants.js file. In this file, there are several constants defined whose values need to be based upon the physical machine the app is running on. The machine will always be unix based with a fixed hostname.

    Now, I believe that process.env and quasar.conf.js can be helpful here in that I can setup a custom variable that could contain the hostname that I am building for. I suppose I could construct a Makefile that manipulates quasar.conf.js and then runs quasar build.

    Does that seem like the right / good solution?

    Has anyone faced a similar situation? How have you resolved it?



  • @ericg97477 There are a couple of app extensions that could be useful.

    1. https://github.com/quasarframework/app-extension-dotenv
    2. https://github.com/quasarframework/app-extension-qenv
      Both of then read in external files and dev/build time so in browser you have access to vars via process.env
      You could create a small js app that reads your constants and generate those files (depending on which app extension you use)

Log in to reply