Open
Description
What problem does this feature solve?
At the moment, only environment variables prefixed with VUE_APP_ are loaded into process.env.
I have a third party library that configures itself using environment variables, however those variables can't load as they aren't Vue.js specific.
What does the proposed API look like?
I can work around the issue in vue.config.js:
module.exports = {
configureWebpack: config => {
const prefixRE = /^VERIDA_/;
Object.keys(process.env).forEach(key => {
if (prefixRE.test(key)) {
config.plugins[1].definitions['process.env'][key] = JSON.stringify(process.env[key]);
}
});
}
}
This is a huge hack however. I'm suggesting a new configuration option be added to @vue/cli-service/lib/util/resolveClientEnv.js
, so that it's possible to provide a custom regex that defines the environment variables that should be made available to Vue.