moduloze icon indicating copy to clipboard operation
moduloze copied to clipboard

Bug: some `default` ESM imports need to be un-special-cased

Open getify opened this issue 2 years ago • 0 comments

RE: https://github.com/getify/import-remap/issues/1#issuecomment-1345722888

Currently, this CJS:

var { default: traverse, } = require("@babel/traverse");

Transpiles to this ESM:

import traverse from "@babel/traverse";

That seems technically correct. But In Babel's case, it needs to transpile to:

import def123 from "@babel/traverse";
var { default: traverse, } = def123;

That's the default import translation for non-default. But probably need a per-dependency config, of some sort, to override this default conversion.

getify avatar Dec 12 '22 01:12 getify