-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
feat: add support for dynamic imports in CJS #10620
Conversation
Should this work on Node.js 14.15.0 with Jest? I have a CJS function like this one: "use strict";
exports.default = import_;
function import_(filepath) {
let res = import(filepath);
throw new Error("Ok 2");
return res;
} When I call it with a valid filepath, Jest exits with a non-zero exit code without reporting any failure (I would expect it to throw "Ok 2"). I thus tried adding EDIT: It's a |
Definitely, as can be seen from the test here, this runs successfully on
That doesn't sound good 🙈 🙉 Ping me when/if you're able to put together a repository. If it's in Babel I'm happy to take a look at some branch |
Does this mean that babel-plugin-dynamic-import-node wouldn't be necessary anymore, or am I misunderstanding this PR? |
correct. If you use |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Since we no longer use
compileFunction
, we can now implement this.Test plan
Test added