Helpers are inlined when using 'externalHelpers'
aparajita opened this issue · comments
The bug reported in #245 remains. Using a global babelHelpers
(as documented in this plugin's README) is currently not possible, and of course should be.
Here's the problem:
rollup-plugin-babel/src/index.js
Lines 108 to 110 in e746832
Line 108 seems wrong.
- If I run the code through
babel
, it's doing the right thing: generatingbabelHelpers.classCallCheck
, etc. - I've got
externalHelpers
set totrue
in the rollup config. - I've checked the result of
preflightCheck
and it's correctly returningEXTERNAL
.
But because line 108 does not check if helpers
is EXTERNAL
, an import is being added to the generated code that results in the helpers being inserted at the top of the generated code. If I change line 108 to:
if (helpers === INLINE) {
then the code is correct, the calls to the external babelHelpers
remain.
Could u prepare a sample repo showcasing the problem? It would help tremendously as I could get into fixing this quicker.
Sure, I'll put something together today.
I noticed this too, and it seems to have started when I upgraded to babel7 and rollup-plugin-babel 4.0.3 from v3.0.7.
Yes, it's a regression that appeared somewhere during that upgrade.
Here's a reduction.
npm i
gulp compile
gulp compile-fixed
Notice that gulp compile
generates the inlined helpers, whereas gulp compile-fixed
uses the global babelHelpers
. The only difference between them is I'm using a fixed rollup-plugin-babel
that changes the line I mentioned.
issue-295.zip
Fixed in 4.3.2, could you confirm it?
Fixed, thank you!