修改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 () { module.exports = function () {
let script = process.env.npm_lifecycle_script; let script = process.env.npm_lifecycle_script;
script = script.substring(script.indexOf("NODE_ENV=") + "NODE_ENV=".length); let name = 'dev';
let name = script.substring(0,script.indexOf("&")) if (script) {
console.log(name); // quasar启动没有这个
name = ".env." + name script = script.substring(script.indexOf('NODE_ENV=') + 'NODE_ENV='.length);
let parsedEnv = DotEnv.config({ path: name }).parsed name = script.substring(0, script.indexOf('&'));
return parsedEnv } else {
if (process.env.NODE_ENV == 'production') {
name = 'prod';
} }
}
console.log(name);
name = '.env.' + name;
let parsedEnv = DotEnv.config({ path: name }).parsed;
return parsedEnv;
};