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

bug: experimental.magicComment not work with react-player
 #1678

Open
gutsyy opened this issue Nov 5, 2024 · 2 comments
Open

bug: experimental.magicComment not work with react-player
 #1678

gutsyy opened this issue Nov 5, 2024 · 2 comments

Comments

@gutsyy
Copy link

gutsyy commented Nov 5, 2024

image

描述:使用 react-player 仍会因 webpack ignore 触发编译错误
复现:https://codesandbox.io/p/devbox/mako-forked-4vg2pl

@stormslowly
Copy link
Member

@sorrycc look at context module analyze

@sorrycc
Copy link
Member

sorrycc commented Dec 24, 2024

排查了下。

最简复现

1、修改 e2e/fixtures/magic-comments.ignore/src/index.ts,加入以下代码。

import(/* makoIgnore: true */ `${foo}`);

错误原因

现在 webpackIgnore/makoIgnore 的实现是在 analyze_deps 里做的,而 context_module 是在 transform 阶段做的,transform 在 analyze_deps 之前,所以 resolve 的 ignore 无法拦截 context_modules 里已经做完的改动。

解法

需要修改 context_module 的实现,不是在 transform 里做,而是放到 resolve 之后,多加一层虚拟模块层。

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants