@emotion/babel-plugin calls path.hoist() in transformCssCallExpression, but that method was removed from @babel/traverse in v8. Any project that upgrades to Babel 8 breaks at build time with no path forward other than pinning Babel back to 7.
Reproduction
- Project on @emotion/babel-plugin@11.13.5
- Upgrade @babel/core (which pulls @babel/traverse@8) to v8
- Run any build that compiles a file using css, styled, or a css JSX prop
Result:
TypeError: <file>.tsx: path.hoist is not a function
at transformCssCallExpression (@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js:1086:10)
at cssTransformer (@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js:1159:3)
at @emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js:847:11
at Array.forEach (<anonymous>)
...
at macroWrapper (babel-plugin-macros/dist/index.js:57:12)
at PluginPass.ImportDeclaration (@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js:1371:9)
An @emotion/babel-plugin release that targets @babel/traverse @8's API (replacing path.hoist() with the
equivalent - probably manual extraction + insertion at the program scope since that's what hoist did under the hood). Happy to send a PR if there's a quick pointer to the intended replacement strategy.
@emotion/babel-plugincallspath.hoist()intransformCssCallExpression, but that method was removed from@babel/traversein v8. Any project that upgrades to Babel 8 breaks at build time with no path forward other than pinning Babel back to 7.Reproduction
Result:
An
@emotion/babel-pluginrelease that targets@babel/traverse@8's API (replacing path.hoist() with theequivalent - probably manual extraction + insertion at the program scope since that's what hoist did under the hood). Happy to send a PR if there's a quick pointer to the intended replacement strategy.