Currently, I am facing an issue with my component library which is built using React, styled-components, framer-motion, Rollup, and Storybook. The library is being consumed by a NextJS website, but when trying to use it, I keep encountering the following error:
TypeError: styled is not a function
The error seems to be related to the code below, taken from the compiled library:
var React = require('react');
var styled = require('styled-components');
var framerMotion = require('framer-motion');
const ButtonElm = styled(framerMotion.motion.button)`
padding: ${props => props.padding};
border-radius: ${props => props.theme.radii.default};
font-size: ${props => props.fontSize};
${props => (props.bold ? "font-weight: bold" : null)};
text-align: center;
cursor: pointer;
width: auto;
display: inline-block;
text-decoration: none;
`;
I have attempted various changes to the build configuration without success. It's unclear what exactly is causing this bug and how to resolve it. Any insight or assistance would be greatly appreciated. Thank you.