-
-
Notifications
You must be signed in to change notification settings - Fork 388
Invariant Violation: loadable: SSR requires @loadable/babel-plugin
, please install it
#466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Try to hoist loadable plugin. I reckon |
i have try do it, but it still not working |
I have similar trouble |
I've double-checked the babel plugin code, and it seems to be legitly not working - the problem is "classical" - https://jamie.build/babel-plugin-ordering.html - different plugins are conflicting with each other. |
but How to fix this problem |
I have similar trouble, SSR requires |
@lovewinders - trouble is with |
my question issue is #484 |
@theKashey any update on how to solve this? I am facing the same issue. |
Update: you can't solve it, there is a really small change to be made to the babel plugin, but I can't find enough time to tackle it. |
@theKashey sure I can test it. Let me know once you've made a PR. |
Hi @theKashey, |
:( |
I have the same issue while wrap // Loadable component
import React from 'react'
import loadable from '@loadable/component'
export default loader => loadable(loader, { fallback: <p> Loading...</p> }) and call it from routes definition: // routes.js
import Loadable from 'components/Loadable'
const Index = Loadable(() => import('@/pages/Index')) after remove this wrap and import // routes.js
import loadable from '@loadbale/component'
const Index = loadable(() => import('@/pages/Index')) Hope to be helpful :) |
Hi,
|
Hi @theKashey tsconfig
Routes.tsx
babel.config
server/render
|
i have this issue only when i create my own custom
using the library |
@suhanw @chen86860 Hi! I faced the same problem as you and managed to solve it via "magic-comments". If you still want to use your own custom functions you can try to use this approach too: https://loadable-components.com/docs/babel-plugin/#magic-comments For example, based on @suhanw comment, try to call your custom |
I ran into this problem as well. We have a wrapper around After a while I realised we also have a So for us it's working as documented. The wrapper we call So for anyone else finding this issue:
|
@suhanw Your comment is pretty old by now so you might have moved passed this already, but, I think the reason that custom function isn't working is that it passes in a function that is impossible for loadable to convert into an object. Maybe the resolveComponent option could help you achieve the thing you want to do? |
Thanks @Ephem ! I honestly can't remember what I wanted to accomplish 😅 but TIL about |
I get this issue aswell and I have tried everything. My components are loaded in like the following:
When the application is running server side it just crashed with this error. Kind of running out of ideas 🤷 |
@negomansini I'm not sure if there are other reasons this error can happen, but from my understanding for some reason I don't think the magic comment is necessary here, but shouldn't hurt either. Are you 100% sure the Babel plugin is added for every environment you have (in case you have separate builds for client and server for example) and that no other Babel plugin is interfering? What helped me narrow my case down was trying to do a minimal reproduction by commenting out all routes and adding a single test route with a single loadable component on it. I hope you'll be able to figure it out! 😄 |
Hey! thanks for the reply. Yeah i've only got one route active at the moment to test this. I am using Webpack 5, and this is only relating to my server side builds. My .babelrc file is what I am using. if i remove a plugin from the list my build fails so its definitely reading from this file... I have also tried specifying the plugins at the webpack config level but still no luck... Yeah really coming to the end of what else I could try....
|
Not sure whether it's a correct solution but it worked in my case. I used
in place of
small l |
IMPORTANT! In my case it was the case that there was a process deleting |
In my case, the version for @loadable/component and @loadable/server was a mismatch. I resolved it by using the same version for both packages. |
I was facing the same issue with typescript. So, I added typescript support on top of server-side-rendering example. Hope it helps someone. Server Side Rendering with TS |
In my case I had a typo in |
🐛 Bug Report
I have configed '@loadable/babel-plugin' in babel.config.js, but when i use SSR to render react file ,then i got this error message

this is my config file

and this is SSR

this is client side route file

i want to get some help and to fix it
The text was updated successfully, but these errors were encountered: