Babel plugin to add displayName to your styled component
let foo = styled('div', {});
let foo = styled('div', {}, 'foo');
Currently, this plugin only works with @LucasUnplugged's fork of Stitches (v0.2.3 or later), though hopefully that will change in the future.
$ npm install babel-plugin-named-stitches-classnames
.babelrc
{
"plugins": ["named-stitches-classnames"]
}
$ babel --plugins named-stitches-classnames script.js
require("@babel/core").transform("code", {
plugins: ["named-stitches-classnames"],
});
This plugin is adapted from @babel/plugin-transform-stitches-display-name, which is itself adapted from @babel/plugin-transform-react-display-name.