Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add react-helmet-async for alias #12511

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b88f38b
fix(docs): 修复 umi 官方文档中《比 Vite 更快的 MFSU》部分的问题 (#12417)
Jinbao1001 May 22, 2024
697603f
fix(docs): 修复 Umi 官方文档中的问题
SK-Luffa May 27, 2024
fb9e7ec
Merge branch 'umijs:master' into master
SK-Luffa Jun 26, 2024
ac3f3c6
Merge branch 'umijs:master' into master
SK-Luffa Jun 29, 2024
3a277ee
1
SK-Luffa Jul 1, 2024
bf38d9c
Merge branch 'umijs:master' into master
SK-Luffa Jul 6, 2024
3435b00
fix(core): handle events on blur (close #10212)
SK-Luffa Jul 6, 2024
6fda717
fix(core): handle events on blur (close #10212)
SK-Luffa Jul 6, 2024
2e4ecf5
fix(core): handle events on blur (close #10212)
SK-Luffa Jul 6, 2024
b0bdf28
fix(core): handle events on blur (close #10212)
SK-Luffa Jul 6, 2024
06181b4
fix(core): handle events on blur (close #10212)
SK-Luffa Jul 6, 2024
9bb0976
fix(core): handle events on blur (close #10212)
SK-Luffa Jul 6, 2024
2b12a3a
Merge branch 'umijs:master' into master
SK-Luffa Jul 10, 2024
ae1f675
fix(build): add react-helmet-async for alias resolution
SK-Luffa Jul 10, 2024
ecad5f1
fix(build): add react-helmet-async for alias resolution
SK-Luffa Jul 10, 2024
6467991
fix(build): add react-helmet-async for alias resolution
SK-Luffa Jul 10, 2024
48875d9
fix(build): add react-helmet-async for alias resolution
SK-Luffa Jul 10, 2024
3aa7940
fix(build): add react-helmet-async for alias resolution
SK-Luffa Jul 10, 2024
54a197c
fix(preset-umi): resolve the path of react-helmet-async within render…
SK-Luffa Jul 11, 2024
e8d057f
Merge branch 'umijs:master' into master
SK-Luffa Jul 11, 2024
e1be908
fix(preset-umi): resolve the path of react-helmet-async within render
SK-Luffa Jul 11, 2024
21fcfe4
fix(preset-umi): resolve the path of react-helmet-async within render
SK-Luffa Jul 11, 2024
0cd1d05
fix(preset-umi): resolve the path of react-helmet-async within render
SK-Luffa Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/preset-umi/src/features/vite/vite.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { IApi } from '../../types';
import { isWindows } from '../../utils/platform';

export default (api: IApi) => {
api.describe({
Expand All @@ -19,6 +20,9 @@ export default (api: IApi) => {

api.modifyConfig((memo) => {
// like vite, use to pre-bundling dependencies in vite mode
if (isWindows) {
memo.alias['react-helmet-async'] = require.resolve('react-helmet-async');
Copy link
Member

@fz6m fz6m Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个依赖在 renderer-react 下,不在 preset-umi 包里面,在 pnpm 严格的依赖结构下是获取不到的吧(此问题无法在此仓库内测试出来,但一般认为 require.resolve 在严格模式下只能取自己包的依赖)。

如果非要找这个包的绝对位置,应该先找 renderer-react ,之后基于 renderer-react 的位置作为起点找 react-helmet-async (参考 plugins/src/react-query 里找 @tanstack/query-core 的位置的代码)。

为了避免找绝对路径比较麻烦,值直接写包名可以吗?

}
memo.alias['@fs'] = api.cwd;
return memo;
});
Expand Down
Loading