styled-components/babel-plugin-styled-components

Doesn't identify styled components in pre-transpiled code

rbong opened this issue · 2 comments

rbong commented

Imports which use _interopRequireDefault are not identified.

// not identified
const styled = _interopRequireDefault(require("styled-components"));

Calls using SequenceExpressions are also not identified.

const Test = (0, styled)('div')();
rbong commented

This is what causes #365

We have run into this issue using module federation and our in-house component library. babel-plugin-styled-components successfully namespaces styled components written within each app, preventing class name collision when multiple apps are loaded on the same page with module federation. However, each app also imports from our component library which is already transpiled, and these component class names are not namespaced, leading to class name collision bugs.

Commenting to add our support for @rbong's PR to add this support after testing it in our dev environment.