-
-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
Labels
@hi-ogawa
Description
Related #903
It's likely what's happening is that there is cjs code
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
which cjsModuleRunnerPlugin transforms into:
const _interop_require_default = (await import("@swc/helpers/_/_interop_require_default")).default;
which then in turn vite import analysis resolves as esm:
const _interop_require_default = (await import(".../@swc/helpers/esm/_interop_require_default.js")).default; // then eventually module runner transform changes: // import -> __vite_ssr_dynamic_import__
Either we have to do:
- if we know package (in this case
@swc/helpers/...) has esm variant, then we should omitdefaultwhen transforming fromrequireto `import. - Or we somehow instruct Vite import analysis to resolve it to cjs version of package. (this doesn't sound possible)
- Or we check during runtime
checkIfItShouldPickDefaultOrNot(await import("..."))based on some heuristics.