-
-
Notifications
You must be signed in to change notification settings - Fork 191
Reproduction of loading commonjs modules from nextjs in the browser #903
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
Reproduction of loading commonjs modules from nextjs in the browser #903
Conversation
Thanks for the repro. This looks like one of currently expected bugs in cjsModuleRunnerPlugin. I think some cjs module has require("@swc/helpers") and that's probably transformed to (await import(".../@swc/helpers/esm/...")).default, but this needs to be avoided somehow (probably either import(".../@swc/helpers/esm/...") without default or resolve it to import(".../@swc/helpers/cjs/...") + default).
I appreciate the reproduction PRs. Additionally can you create a tracking issue which points to each reproduction?
I moved cjsModuleRunnerPlugin to the minimal plugin, to see if that would solve common js issues in the browser example.
I could succesfully load
markedand load this context provider fromnext:But it gave cryptic messages for some other nextjs modules:
The error is:
It seems that the following module doesn't get loaded correctly:
So that the
_method is not defined: