Skip to content

Commit

Permalink
feat: pdfjs-dist for mako
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni committed Jul 31, 2024
1 parent af9fb19 commit 03f273a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/alita/src/features/compatibleMako.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { IApi } from 'umi';
import { dirname } from 'path';

export default (api: IApi) => {
// 强制关闭
if (api.userConfig.mako !== false) {
// https://github.com/umijs/mako/issues/979
const version = require(`${dirname(
require.resolve('pdfjs-dist/package.json'),
)}/package.json`).version;
if (version === '2.1.266') {
api.modifyConfig((memo) => {
// 可能通过内置默认开启
if (api.config.mako) {
memo.alias['pdfjs-dist'] = dirname(
require.resolve('@lingxiteam/pdfjs-dist/package.json'),
);
}
return memo;
});
}
}
};
1 change: 1 addition & 0 deletions packages/alita/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default (api: IApi) => {
require.resolve('./commands/generate/pages'),
// aigc
// require.resolve('@alita/plugin-azure'),
require.resolve('./features/compatibleMako'),
];
const plugins = [
require.resolve('@alita/plugins/dist/aconsole'),
Expand Down

0 comments on commit 03f273a

Please sign in to comment.