@emotion/babel-plugin incompatible with Babel 8
Author: tylercraftCreated Jun 23, 2026Updated Jun 23, 2026
Labelsbugneeds triage
@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/[email protected]
- 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.
Source: emotion-js/emotion