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 am trying all day to get my app running on nodejs for ssr but it has problems when importing certain modules like styled-components.
It is somehow related to the default import/export.
When I try to import styled it tells me styled is not a functions.
How can I fix this?
Example:
// test.mjs
import styled from "styled-components";
console.log("Object.keys(styled)", Object.keys(styled));
I have an react app where I am using Typescript with vite and its running fine in the browser.
When I build with --ssr flag it outputs the following import statement in the output file:
import styled, { createGlobalStyle, css, ThemeProvider as ThemeProvider$1, ThemeContext, keyframes, ServerStyleSheet, StyleSheetManager } from "styled-components";
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying all day to get my app running on nodejs for ssr but it has problems when importing certain modules like styled-components.
It is somehow related to the default import/export.
When I try to import styled it tells me styled is not a functions.
How can I fix this?
Example:
Outputs:
I have an react app where I am using Typescript with vite and its running fine in the browser.
When I build with
--ssr
flag it outputs the following import statement in the output file:Beta Was this translation helpful? Give feedback.
All reactions