Skip to content

@babel/runtime 7.13.10 breaking on JSPM #13059

@guybedford

Description

@guybedford

Bug Report

  • I would like to work on a fix!

Current behavior

Input Code

Loading @babel/[email protected]/helpers/interopRequireWildcard.js includes a require to @babel/runtime/helpers/typeof which is mapped to resolve to @babel/[email protected]/helpers/esm/typeof.js in all environments that aren't Node.js environments by the exports definitions.

This file then also uses the import pattern:

var _typeof = require("@babel/runtime/helpers/typeof")["default"];

Where accessing the default off of the helpers/esm/typeof.js file makes _typeof undefined.

Expected behavior

"require" should not remap to an ESM module, or if it does the interop should take into account the varying signature of the exports.

Possible Solution

I'm not sure what would be best actually. Ideally using relative paths in the first place would avoid this. Alternatively using the "require" condition instead of the "node" condition. If it is really desired to replace the CJS require statements with ES modules then the Webpack / build-tool-specific "module" condition could be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions