You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've initiated a new project utilizing Vite, React, and Typescript, and I've opted for styled-components for UI development. However, I'm encountering difficulties in running createGlobalStyle. Interestingly, when I downgrade styled-components to version 5.3.0, the issue resolves, but ideally, I'd prefer to utilize the latest version of the library.
I understand the issue. In vite.config.ts, resolve.MainFields is set by default to ['browser', 'module', 'jsnext:main', 'jsnext'], but it seems it's not working because I left it as an empty array. This means styled-components determines whether it runs in the browser or on the server from here.
To enable createGlobalStyle to work, you can either remove mainFields or set it to ['browser', 'module', 'jsnext:main', 'jsnext'].
I've initiated a new project utilizing Vite, React, and Typescript, and I've opted for styled-components for UI development. However, I'm encountering difficulties in running createGlobalStyle. Interestingly, when I downgrade styled-components to version 5.3.0, the issue resolves, but ideally, I'd prefer to utilize the latest version of the library.
My Package.json:
Has anyone else experienced this problem, and are there any known resolutions or workarounds available?
The text was updated successfully, but these errors were encountered: