feat: 修复错误的路径

This commit is contained in:
万纯 2020-12-02 12:18:26 +08:00
parent 1a1ae0cf11
commit 1f451393b0
2 changed files with 4 additions and 6 deletions

View File

@ -3,9 +3,7 @@ import { join } from 'path';
import { winPath } from '@umijs/utils';
import { runtimePath } from '../../../utils/constants';
export function importsToStr(
imports,
) {
export function importsToStr(imports) {
return imports.map((imp) => {
const { source, specifier } = imp;
if (specifier) {
@ -48,14 +46,14 @@ export default function (api) {
key: 'addEntryImportsAhead',
type: api.ApplyPluginsType.add,
initialValue: []
}),
})
).join('\r\n'),
imports: importsToStr(
await api.applyPlugins({
key: 'addEntryImports',
type: api.ApplyPluginsType.add,
initialValue: []
}),
})
).join('\r\n')
})
});

View File

@ -22,7 +22,7 @@ export default (api) => {
});
const namespace = 'plugin-request';
const requestTemplate = readFileSync(join(__dirname, 'template', 'request.ts'), 'utf-8');
const requestTemplate = readFileSync(join(__dirname, 'template', 'request.js'), 'utf-8');
api.onGenerateFiles(() => {
// 文件写出
const { dataField = '', messageUI } = api.config.request;