-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
add support for dynamic requests in require() and import() #7398
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
10 Ignored Deployments
|
🟢 Turbopack Benchmark CI successful 🟢Thanks |
|
✅ This change can build |
…#62092) ### What? see vercel/turborepo#7398 ### Turbopack Changes * vercel/turborepo#7367 <!-- Tobias Koppers - add custom_extensions to resolve options context --> * vercel/turborepo#7398 <!-- Tobias Koppers - add support for dynamic requests in require() and import() --> Closes PACK-2513
if let Expr::Call(call_expr) = expr { | ||
let args = std::mem::take(&mut call_expr.args); | ||
*expr = match args.into_iter().next() { | ||
Some(ExprOrSpread { expr, spread: None }) => pm.create_require(*expr), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I just noticed this now, but this looks very wrong, this should insert a string, not a require call
…rborepo#7398) ### Description Refactors `PatternMatching` to support a map of multiple matches by key. Based on the new `RequestKey` support for resolving. Code Generation for `require("./dir/"+ expr)` will emit a map of `__turbopack_lookup__({ "./a": () => ..., "./b": () => ... }, "./dir/" + expr)`. The output format isn't really optimized yet, that's work for future PRs. ### Testing Instructions added a test case, enabled one previously skipped test case Closes PACK-2512
…rborepo#7398) ### Description Refactors `PatternMatching` to support a map of multiple matches by key. Based on the new `RequestKey` support for resolving. Code Generation for `require("./dir/"+ expr)` will emit a map of `__turbopack_lookup__({ "./a": () => ..., "./b": () => ... }, "./dir/" + expr)`. The output format isn't really optimized yet, that's work for future PRs. ### Testing Instructions added a test case, enabled one previously skipped test case Closes PACK-2512
…rborepo#7398) ### Description Refactors `PatternMatching` to support a map of multiple matches by key. Based on the new `RequestKey` support for resolving. Code Generation for `require("./dir/"+ expr)` will emit a map of `__turbopack_lookup__({ "./a": () => ..., "./b": () => ... }, "./dir/" + expr)`. The output format isn't really optimized yet, that's work for future PRs. ### Testing Instructions added a test case, enabled one previously skipped test case Closes PACK-2512
…rborepo#7398) ### Description Refactors `PatternMatching` to support a map of multiple matches by key. Based on the new `RequestKey` support for resolving. Code Generation for `require("./dir/"+ expr)` will emit a map of `__turbopack_lookup__({ "./a": () => ..., "./b": () => ... }, "./dir/" + expr)`. The output format isn't really optimized yet, that's work for future PRs. ### Testing Instructions added a test case, enabled one previously skipped test case Closes PACK-2512
Description
Refactors
PatternMatching
to support a map of multiple matches by key. Based on the newRequestKey
support for resolving.Code Generation for
require("./dir/"+ expr)
will emit a map of__turbopack_lookup__({ "./a": () => ..., "./b": () => ... }, "./dir/" + expr)
.The output format isn't really optimized yet, that's work for future PRs.
Testing Instructions
added a test case, enabled one previously skipped test case
Closes PACK-2512