Commit 7d40773b5b0ee69f72e4e892fe77808f13243636

Authored by 钱忠旺
Committed by GitHub
1 parent 935d4fc1

style(buildConf.ts): 增加函数接口和修改默认的 (#1259)

增加CreateConfigParams接口,并修改createConfig参数默认值

Co-authored-by: QIANZW <1870271825@gqq.com>
Showing 1 changed file with 12 additions and 6 deletions
build/script/buildConf.ts
... ... @@ -5,17 +5,23 @@ import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from &#39;../constant&#39;;
5 5 import fs, { writeFileSync } from 'fs-extra';
6 6 import chalk from 'chalk';
7 7  
8   -import { getRootPath, getEnvConfig } from '../utils';
  8 +import { getEnvConfig, getRootPath } from '../utils';
9 9 import { getConfigFileName } from '../getConfigFileName';
10 10  
11 11 import pkg from '../../package.json';
12 12  
  13 +interface CreateConfigParams {
  14 + configName: string;
  15 + config: any;
  16 + configFileName?: string;
  17 +}
  18 +
13 19 function createConfig(
14   - {
15   - configName,
16   - config,
17   - configFileName = GLOB_CONFIG_FILE_NAME,
18   - }: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} },
  20 + { configName, config, configFileName }: CreateConfigParams = {
  21 + configName: '',
  22 + config: {},
  23 + configFileName: GLOB_CONFIG_FILE_NAME,
  24 + },
19 25 ) {
20 26 try {
21 27 const windowConf = `window.${configName}`;
... ...