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 5 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
1 change: 1 addition & 0 deletions packages/bundler-vite/src/config/transformer/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default (function alias(userConfig) {
alias: [
// to support less-loader ~ for local deps, refer: https://github.com/vitejs/vite/issues/2185
{ find: /^~/, replacement: '' },
{ find: /react-helmet-async/, replacement: 'react-helmet-async' },
Copy link
Member

Choose a reason for hiding this comment

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

这里不需要精确限定正则开头和结尾吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个包未来依赖的版本会变化吗?如果不会变化或者确定暂时不会变化的话,可以锁定开头和结尾的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

主要是担心如果锁定开头和结尾,如果未来依赖的新的包,而这里没有进行修改的话,会不会再次产生这个问题?

Copy link
Member

@xierenyuan xierenyuan Jul 9, 2024

Choose a reason for hiding this comment

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

逻辑放到 packages/preset-umi/src/features/vite/vite.ts 下吧、加一下 window 判断 import { isWindows } from '../../utils/platform' 在增加别名逻辑 理论上直接控制 modifyConfig 就行 可以试试下面的代码

// packages/preset-umi/src/features/vite/vite.ts
import { isWindows } from '../../utils/platform' 

  api.modifyConfig((memo) => {
   if (isWindows) {
     memo.alias['react-helmet-async'] = 'react-helmet-async'
    }
    return memo;
  });

],
},
};
Expand Down
Loading