Skip to content

Bug: swc does not import the _interopRequireDefault function when it is referenced #138

Closed
@lily-mara

Description

@lily-mara

If you try compiling the following with swc:

import Foo from 'bar';

You get this:

'use strict';
var _bar = _interopRequireDefault(require('bar'));

The function _interopRequireDefault is referenced, though never defined, leading to ReferenceErrors.

There are other functions that have the same behavior:

  • _interopRequireWildcard

Expected: If swc inserts references to functions, it will define or import those functions.

Actual: swc references numerous functions that it does not define/import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions