You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swc does not inline _interopRequireDefault when it is needed and when externalHelpers is false. Instead it inlines _interopRequireWildcard, although that function is not used.
Input code
I can reproduce the bug using SWC's JS API
swc.transformSync(`
import Foo from "bar";
export {Foo} from "bar";
`, {
module: {type: 'commonjs'}
})
The output includes the _interopRequireWildcard helper, but omits _interopRequireDefault.
I realize now that the problem is slightly different than I described. _interopRequireWildcard is the correct helper. The bug is that swc emits var _bar = _interopRequireDefault(require("bar")); when it should emit var _bar = _interopRequireWildcard(require("bar"));
cspotcode
changed the title
swc inlines _interopRequireWildcard when it needs _interopRequireDefault
swc uses _interopRequireDefault when it should use _interopRequireWildcardJun 17, 2021
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
EDIT this description is wrong; see #1786 (comment)
Describe the bug
swc does not inline
_interopRequireDefault
when it is needed and whenexternalHelpers
is false. Instead it inlines_interopRequireWildcard
, although that function is not used.Input code
I can reproduce the bug using SWC's JS API
The output includes the
_interopRequireWildcard
helper, but omits_interopRequireDefault
.Config
n/a
Expected behavior
swc inlines the
_interopRequireDefault
helper function when it is used.Version
The version of @swc/wasm: 1.2.58
Additional context
Possibly related to #138
The text was updated successfully, but these errors were encountered: