styled-components / xstyled

A utility-first CSS-in-JS framework built for React. 💅👩‍🎤⚡️
https://xstyled.dev
MIT License
2.27k stars 107 forks source link

[bug] Attempted import error: 'createColorModeProvider' is not exported from '@xstyled/core'. #353

Closed jsartisan closed 2 years ago

jsartisan commented 2 years ago

Facing this error when using ThemeProvider from xstyled.

Attempted import error: 'createColorModeProvider' is not exported from '@xstyled/core'.

The version of styled-components I am using is ^5.2.0

jsartisan commented 2 years ago

Really wanted to love this project but got stuck on the above error and couldn't proceed :/

D1no commented 2 years ago

@jsartisan Without a reproduction nobody can help you. That applies for everything. Create a codesandbox.io example — it's free — that reproduces your error and post it with your ask for help.

Also: Styled Components was made by the same guys that have abandoned various open source projects and wouldn't be surprised if the error comes from styled components. If you are starting out, you are much better served by using emotion — an actual end-to-end tested CSS-in-JS library.

sebastiansas1 commented 2 years ago

I'm also getting this error on build:

#13 72.21 ../node_modules/@xstyled/system/dist/index.mjs
#13 72.21 Attempted import error: 'assign' is not exported from '@xstyled/util'.

In my package.json

"dependencies": {
    "@xstyled/styled-components": "3.1.2",
    "styled-components": "5.3.3",
},
"resolutions": {
    "**/@xstyled/core": "3.1.2",
    "**/@xstyled/system": "3.1.2",
    "**/@xstyled/util": "3.1.0"
}

The error above gets triggered when I build my environment in Docker.

Node version: 14.17.x Install command: RUN yarn build && yarn install --production --ignore-scripts --prefer-offline

PS: using yarn workspaces + lerna (monorepo setup)

sebastiansas1 commented 2 years ago

@D1no I've tried your suggestion to use emotion, but I still get the same error:

Dependencies used:

"@emotion/react": "11.6.0",
"@emotion/styled": "11.6.0",
"@xstyled/core": "3.1.0",
"@xstyled/util": "3.1.0",
"@xstyled/emotion": "3.1.0",
gregberge commented 2 years ago

I think you have several versions of xstyled in the project.