Skip to content

Commit

Permalink
fix(preset): umi default alias cannot working with integrated mode
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Dec 8, 2020
1 parent 0466067 commit ff46f60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions packages/preset-dumi/src/plugins/features/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@ export default (api: IApi) => {

return memo;
});

// re-enable @ & @@ umi default alias for integrated mode
if (isIntegrateUmi) {
api.modifyDefaultConfig((memo) => {
memo.alias['@'] = api.paths.absSrcPath;
memo.alias['@@'] = api.paths.absTmpPath;

return memo;
});
}
};
4 changes: 2 additions & 2 deletions packages/preset-dumi/src/routes/getRouteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default async (api: IApi, opts: IDumiOpts): Promise<IRoute[]> => {
const exampleRoutePrefix = opts.mode === 'site' ? '/_' : '/_examples/';
const theme = await getTheme();
const userRoutes = opts.isIntegrate
? await api.applyPlugins({
? (await api.applyPlugins({
key: 'dumi.getRootRoute',
type: api.ApplyPluginsType.modify,
initialValue: api.userConfig.routes,
})
}))?.routes
: api.userConfig.routes;

if (userRoutes) {
Expand Down

0 comments on commit ff46f60

Please sign in to comment.