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

try resolve 不支持 a || require('not-found') #1007

Closed
3 tasks
sorrycc opened this issue Apr 2, 2024 · 1 comment · Fixed by #1738
Closed
3 tasks

try resolve 不支持 a || require('not-found') #1007

sorrycc opened this issue Apr 2, 2024 · 1 comment · Fixed by #1738
Labels
bug Something isn't working

Comments

@sorrycc
Copy link
Member

sorrycc commented Apr 2, 2024

背景

https://unpkg.com/browse/[email protected]/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js 这里有用到这个语法,webpack 不报错,mako 报错。

复现

try {
  const a = 1 && require('not-found-module');
} catch(e) {}

期望不报错,实际报错。

方案

  • 修改 transform_try_resolve.rs,支持这类场景
  • 在 transform_try_resolve.rs 里补充相关用例
  • 在 e2e/fixtures/resolve.failed-in-try-statement/src/index.tsx 里补充相关用例
@sorrycc sorrycc added the bug Something isn't working label Apr 2, 2024
@notcold
Copy link
Contributor

notcold commented Jan 3, 2025

@sorrycc 指给我,我提个pr吧

notcold pushed a commit to notcold/mako that referenced this issue Jan 3, 2025
support BinaryExpression
sorrycc pushed a commit that referenced this issue Jan 8, 2025
support BinaryExpression

Co-authored-by: shikuan.sk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants