修改quasar启动报错

This commit is contained in:
dong 2023-10-20 10:58:31 +08:00
parent c5f033a598
commit d2f0668323

View File

@ -1,12 +1,19 @@
const DotEnv = require('dotenv')
const DotEnv = require('dotenv');
module.exports = function () {
let script = process.env.npm_lifecycle_script;
script = script.substring(script.indexOf("NODE_ENV=") + "NODE_ENV=".length);
let name = script.substring(0,script.indexOf("&"))
console.log(name);
name = ".env." + name
let parsedEnv = DotEnv.config({ path: name }).parsed
return parsedEnv
let name = 'dev';
if (script) {
// quasar启动没有这个
script = script.substring(script.indexOf('NODE_ENV=') + 'NODE_ENV='.length);
name = script.substring(0, script.indexOf('&'));
} else {
if (process.env.NODE_ENV == 'production') {
name = 'prod';
}
}
console.log(name);
name = '.env.' + name;
let parsedEnv = DotEnv.config({ path: name }).parsed;
return parsedEnv;
};