Skip to content

Commit

Permalink
🐛 fix(options): 优化 options url
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jan 24, 2021
1 parent 05bea69 commit 259d83e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion example/.umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export default defineConfig({
48: 'logo/logo@48.png',
128: 'logo/logo@128.png',
},
optionsUI: '@/pages/options',
// optionsUI: '@/pages/options',
optionsUI: {
page: '@/pages/options',
openInTab: true,
},
popupUI: '@/pages/index',
permissions: ['http://*/*', 'https://*/*'],
background: {
Expand Down
8 changes: 3 additions & 5 deletions src/functions/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ export default (api: IApi) => {
htmlSuffix: true,
};

const extension = <extensionsPlugin.Config>(
config.extensions
);
const extension = <extensionsPlugin.Config>config.extensions;

const { optionsUI, popupUI } = extension;

// 插入 routes
const optionRoute = getRouteFromConfig(optionsUI, '/option');
const optionRoute = getRouteFromConfig(optionsUI, '/options');
const popUpRoute = getRouteFromConfig(popupUI, '/');

const extensionRoutes = [optionRoute, popUpRoute].filter(
Expand All @@ -37,7 +35,7 @@ export default (api: IApi) => {
}
// 为替换 manifest 的 page 做准备
if (optionRoute) {
UIPageKeyMap.option.output = 'option.html';
UIPageKeyMap.option.output = 'options.html';
}
if (popUpRoute) {
UIPageKeyMap.popup.output = 'index.html';
Expand Down

0 comments on commit 259d83e

Please sign in to comment.