Replies: 9 comments
-
It seems that this gives an error only when using typescript. Javascript projects work |
Beta Was this translation helpful? Give feedback.
-
I'm having the same problem but only after i upgraded NextJs to 14+, my project is using a ui library build with vite but even after upgrading the vite version and changing the |
Beta Was this translation helpful? Give feedback.
-
Running into the same issue using vite Looks like dependency |
Beta Was this translation helpful? Give feedback.
-
Hiya guys, is this still a problem? I am trying to create lib and I want to use styled components for styling. The lib will be used in NextJS 14. |
Beta Was this translation helpful? Give feedback.
-
i'm having the same, exact error. Same styled.button exported in a simple vite based package. When i try to import it in another project that uses webpack + babel it will throw the same error, Cannot read withConfig Is there anythings we can do? |
Beta Was this translation helpful? Give feedback.
-
Same error using styled-components as a peer-dep, but only in tests |
Beta Was this translation helpful? Give feedback.
-
Hi is there any solution to this? |
Beta Was this translation helpful? Give feedback.
-
@alexomon018 @dj-fiorex @Saggitarie import styled2 from 'styled-components'
import { createGlobalStyle, ServerStyleSheet, StyleSheetManager } from 'styled-components'
import { isFunction } from '@src/utils/type.js'
let styled = styled2
if (!isFunction(styled2.div)) {
styled = styled2.default
}
export { createGlobalStyle, ServerStyleSheet, StyleSheetManager }
export default styled |
Beta Was this translation helpful? Give feedback.
-
we solved our issue by changing all instances of import styled from 'styled-components' to import { styled } from 'styled-components' |
Beta Was this translation helpful? Give feedback.
-
Hi,
i am creating a styled-components library and i build it using vite.
Whenever i create a new react application using vite i can import my components and everything works correctly.
However, when i create a react app using
nextjs
orremix
i get errors similar to the following:or
my lib is as simple as
src/components/Button/Button.tsx
src/components/index.ts
src/index.ts
my
vite.config.ts
:and my
package.json
:Beta Was this translation helpful? Give feedback.
All reactions