mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
sdf
This commit is contained in:
parent
fd318c62e3
commit
37a303c11e
@ -3,6 +3,16 @@ import { join } from 'path';
|
|||||||
import { winPath } from '@fesjs/utils';
|
import { winPath } from '@fesjs/utils';
|
||||||
import { runtimePath } from '../../../../utils/constants';
|
import { runtimePath } from '../../../../utils/constants';
|
||||||
|
|
||||||
|
function getAppPath(absSrcPath) {
|
||||||
|
for (const suffix of ['.js', '.ts', '.jsm']) {
|
||||||
|
const p = winPath(join(absSrcPath, `app${suffix}`));
|
||||||
|
if (existsSync(p)) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
export default function (api) {
|
export default function (api) {
|
||||||
const {
|
const {
|
||||||
paths,
|
paths,
|
||||||
@ -33,12 +43,11 @@ export default function (api) {
|
|||||||
'onRouterCreated'
|
'onRouterCreated'
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
const appPath = winPath(join(paths.absSrcPath, 'app.js'));
|
|
||||||
const plugins = await api.applyPlugins({
|
const plugins = await api.applyPlugins({
|
||||||
key: 'addRuntimePlugin',
|
key: 'addRuntimePlugin',
|
||||||
type: api.ApplyPluginsType.add,
|
type: api.ApplyPluginsType.add,
|
||||||
initialValue: [
|
initialValue: [
|
||||||
existsSync(appPath) && appPath
|
getAppPath(paths.absSrcPath)
|
||||||
].filter(Boolean)
|
].filter(Boolean)
|
||||||
});
|
});
|
||||||
api.writeTmpFile({
|
api.writeTmpFile({
|
||||||
|
@ -44,9 +44,8 @@ export default async ({ api, watch }) => {
|
|||||||
type: api.ApplyPluginsType.add,
|
type: api.ApplyPluginsType.add,
|
||||||
initialValue: [
|
initialValue: [
|
||||||
paths.absPagesPath,
|
paths.absPagesPath,
|
||||||
// 貌似没用到
|
join(paths.absSrcPath, 'app.js'),
|
||||||
// join(paths.absSrcPath, api.config?.singular ? 'layout' : 'layouts'),
|
join(paths.absSrcPath, 'app.ts')
|
||||||
join(paths.absSrcPath, 'app.js')
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
lodash
|
lodash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user