Closed pi0 closed 5 years ago
I was able to further isolate this issue with the provided repository by replacing @babel/preset-env
with @babel/plugin-transform-modules-commonjs
. What I don't know yet is if we've exposed a bug in the babel ESM -> CJS transform plugin, or if it's inappropriate for us to call path.scope.crawl()
.
@leebyron unfortunately we may have to revert your patch. I did a quick experiment and was able to get babel-plugin-lodash working with babel-plugin-istanbul@5.1.1 by adding path.scope.crawl()
to the end of the ImportDeclaration.exit()
function at https://github.com/lodash/babel-plugin-lodash/blob/7d2342a3b849c3c8ef3b2d904b7e2394205466ff/src/index.js#L84. I'm not sure if this change is actually appropriate or just shifts the issue over there.
I've just pushed changes to revert #192 and add a regression test to verify that babel-plugin-istanbul
and @babel/plugin-transform-modules-commonjs
play nice together. I'll try to push an updated release shortly.
@leebyron until we can find a new solution to #192 you will need to pin your dependency to babel-plugin-istanbul@5.1.2
.
babel-plugin-istanbul@5.1.3 is now released.
This issue introduced with
5.1.2
(5.1.1
and below are fine)Reproduction repo: https://github.com/pi0/babel-plugin-istanbul-bug (Use
yarn test
)Reverting this change by #192 fixes problem.
Details
When using
@babel/preset-env
:Transpiles into: (Correct)
Using
babel-plugin-istanbul@5.1.2
: (Bug)Using
babel-plugin-istanbul@5.1.1
(Correct)