You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At least these were needed for the shop#3.0 modules-based project, and probably more:
interopRequireDefault
interopRequireWildcard
wrapNativeSuper
(Even after adding these, I am still getting Uncaught TypeError: m.assertThisInitialized is not a function on shop#3.0 when compiling to ES5).
But it seems like we really need a better solution than a hard-coded list of helpers (https://github.com/Polymer/polymer-build/blob/master/gulpfile.js#L112). Babel figures out what helpers it needs, and optionally injects them inline. We don't rely on that, since that causes lots of redundant helpers in every script, and have our own set that we inject into the entrypoint instead.
Since we do whole program analysis, is there a way to ask Babel which helpers it needed, and create a final de-duped set?
The text was updated successfully, but these errors were encountered:
Apparently Babel used to expose a usedHelpers object, which we could have used to generate a minimal set of application-wide babel helpers. However, it was removed in Babel 7 (babel/babel#6835). The much better solution will be to use the transform-runtime plugin which will transform helpers to be imports from the babel-runtime module. Filed #128 to do that.
In the short term, though, I'm just going to expand our current static global helpers list to include everything we seem to be missing at the moment.
Also, even when ES5 compilation is off, the AMD babel transform requires some helpers. Currently we don't inject any helpers unless ES5 compilation is on, so I will need to change that logic a bit too.
At least these were needed for the
shop#3.0
modules-based project, and probably more:(Even after adding these, I am still getting
Uncaught TypeError: m.assertThisInitialized is not a function
onshop#3.0
when compiling to ES5).But it seems like we really need a better solution than a hard-coded list of helpers (https://github.com/Polymer/polymer-build/blob/master/gulpfile.js#L112). Babel figures out what helpers it needs, and optionally injects them inline. We don't rely on that, since that causes lots of redundant helpers in every script, and have our own set that we inject into the entrypoint instead.
Since we do whole program analysis, is there a way to ask Babel which helpers it needed, and create a final de-duped set?
The text was updated successfully, but these errors were encountered: