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'm working on a Typescript SSR React app on Vite. I'm having an issue with several modules when importing default property from the module.
The issue is when I'm trying to import default from module like: import loadable from "@loadable/component";
or import styled from "styled-components";
Both of them are default exports. On the client works perfectly but on SSR I get something like Error: _loadable_component.default is not a function. Then to make it work on SSR I need to do something like loadable.default or styled.default.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
Hello,
I'm working on a Typescript SSR React app on Vite. I'm having an issue with several modules when importing default property from the module.
The issue is when I'm trying to import default from module like:
import loadable from "@loadable/component";
or
import styled from "styled-components";
Both of them are default exports. On the client works perfectly but on SSR I get something like
Error: _loadable_component.default is not a function
. Then to make it work on SSR I need to do something like loadable.default or styled.default.I found a workaround for this, but I don't think this is the way to go: styled-components/styled-components#3832 (comment)
Is there anything I'm missing? Thanks in advance!
Reproduction
https://stackblitz.com/edit/vitejs-vite-kb6oam?file=package.json
Steps to reproduce
The steps are:
yarn install
yarn start
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: