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

View File

@ -22,7 +22,7 @@ export default (api) => {
}); });
const namespace = 'plugin-request'; 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(() => { api.onGenerateFiles(() => {
// 文件写出 // 文件写出
const { dataField = '', messageUI } = api.config.request; const { dataField = '', messageUI } = api.config.request;