[Vuejs]-Vue.js: load js file based on environment

0👍

I am not sure if this is exactly what you are looking for but I’ll try to help:

To dynamically load the js file based on the environment you can create a function that returns an import:

function getConfig(mode) {
  return import(`./environment/${mode}/aws-exports`)  // import returns a Promise
}

Note: remember that import is a Promise so you might need to await it.

Leave a comment