-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
Server side rendering have no effect in 3.0.x #128
Comments
Hello @code-mcx, can you create a branch with your changes, I will take a look. |
You must use |
Hi @neoziro , i change When i use const asyncData = route.component.Component.asyncData; How i get the loaded component in Here is my branch with problem. |
Hello @code-mcx, I gave a look and detect several problems:
|
Hi @neoziro , I noticed that const router = [
{
path: "/bar",
component: loadable(() => import("../views/Bar"))
},
{
path: "/baz",
component: loadable(() => import("../views/Baz"))
},
{
path: "/foo",
component: loadable(() => import("../views/Foo"))
},
{
path: "/top-list",
component: loadable(() => import("../containers/TopList")),
exact: true
},
{
path: "/top-list/:id",
component: loadable(() => import("../containers/TopDetail"))
}
]; When i visit I run build for production, start the server, then visit Please take a look the new code, change is here |
There was some issues I fixed in #130, please first upgrade to v4.0.2. Several issues persist:
Please tell me if it works for you! |
Your issue with |
Also, webpack plugin is now always required. |
Thanks. Tomorrow morning, I'll try. |
Hi @neoziro . I upgraded
I also found a problem that when i run in production mode, first visit Now the new version disable webpack common chunk and must use
I hope the new version can support those tow features. |
Yes I know that these two features are very important and I plan to support it. About your CSS problem, this library is only focused on JS part. It does not support ant CSS Code Splitting. If you want to Code Split CSS, I suggest you to use a CSS in JS library. |
SSR has been completely rebuilt in v5, chunk hash is supported and CSS is also supported! Can you please give it a try? 🙏 I close this issue because it is now outdated. |
Hi @neoziro . I tried this new version. It works well for my problems. |
@code-mcx oh, it looks like a filter is missing, I will fix it thank you! |
Source maps must no be included in links. See #128
@code-mcx fixed and published |
Thanks. |
Hello @neoziro . I think the initial script shouldn't have First i run the app in development, then change some code to trigger HMR, the browser add a new js file. When i refresh the browser, sometimes the browser throw an exception. I guess that the new file need execution orderly. Maybe can use |
Can you give me your exact configuration, I would like to know what is going on. The issue looks like to be linked with Hot Reloading. Loading the main js file without async is not very good for performance. I think we could find a solution without affecting performances. |
Look at here. |
@code-mcx I see the problem, I think we should ignore "hot-update.js" files, they should not be added into scripts but only available to be loaded by Webpack Hot Loader runtime. I will try to fix it soon. Thanks for your feedback. |
Hi!
I have writen a ssr demo using
2.2.3
,here is my demo.Now i want to upgrade
loadable-components
from2.2.3
to3.0.x
,only a few things have been doneimport Loadable from "loadable-components";
withimport Loadable from "@loadable/component";
.loadable-components/babel
with"@loadable/babel-plugin"
.src/server.js
replace old api.
server.js
After call
ReactDOMServer.renderToString()
,i callloadableState.getScriptTags()
,but return<script>window.__LOADABLE_STATE__ = [];</script>
Thanks
The text was updated successfully, but these errors were encountered: