Skip to content

Commit

Permalink
feat: pdfjs-dist for mako
Browse files Browse the repository at this point in the history
feat: pdfjs-dist for mako
  • Loading branch information
xiaohuoni authored Jul 31, 2024
2 parents af9fb19 + 70a6366 commit fa62b99
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-weeks-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'alita': patch
---

feat: compatible mako
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) {
api.modifyConfig((memo) => {
// 可能通过内置默认开启
if (api.config.mako) {
// 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') {
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 fa62b99

Please sign in to comment.