mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
fix: keep spaces of env config on prod build (#2015)
This commit is contained in:
parent
aefde45ad5
commit
740d160198
@ -21,13 +21,15 @@ function createConfig(params: CreateConfigParams) {
|
|||||||
try {
|
try {
|
||||||
const windowConf = `window.${configName}`;
|
const windowConf = `window.${configName}`;
|
||||||
// Ensure that the variable will not be modified
|
// Ensure that the variable will not be modified
|
||||||
const configStr = `${windowConf}=${JSON.stringify(config)};
|
let configStr = `${windowConf}=${JSON.stringify(config)};`;
|
||||||
|
configStr += `
|
||||||
Object.freeze(${windowConf});
|
Object.freeze(${windowConf});
|
||||||
Object.defineProperty(window, "${configName}", {
|
Object.defineProperty(window, "${configName}", {
|
||||||
configurable: false,
|
configurable: false,
|
||||||
writable: false,
|
writable: false,
|
||||||
});
|
});
|
||||||
`.replace(/\s/g, '');
|
`.replace(/\s/g, '');
|
||||||
|
|
||||||
fs.mkdirp(getRootPath(OUTPUT_DIR));
|
fs.mkdirp(getRootPath(OUTPUT_DIR));
|
||||||
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
|
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user