Home > Software engineering >  Vue Uncaught ReferenceError: process is not defined
Vue Uncaught ReferenceError: process is not defined

Time:02-14

I'm working on a Vue typescript project. I want to use process.env.var_name to adjust the project is in development mode or production mode, just like

const isProduct = process.env.APP_ENV === "prod";

; however I got an error below. I never meet this error before, so could any one give me a clue why this would happen so I can try to figure out what happend in the project and then fix it.enter image description here

CodePudding user response:

Env's variables must start with VUE_APP_, so try to change APP_ENV into VUE_APP_ENV. About the CORS error you have to enable your FE from your BE.

CodePudding user response:

I have a quasar project before and this one works for me. I installed the dotenv library by running the yarn command "yarn add --dev dotenv". Please let me know.

  • Related