-
Notifications
You must be signed in to change notification settings - Fork 0
Compatibility with ExpressJS for Server Side Rendering #107
Comments
Are you able to post a minimal reproduction of the issue? This library works with create-react-app out the box (https://github.com/surevine/govuk-react-jsx-examples) but you mention express - clearly there's something extra going on here. It certainly sounds like a loader issue that should be easily resolved - I just need to see the context of what your app looks like. If you could strip the app back to the bare minimum "hello world", but demonstrating the bug and stick it in a github repo that would be awesome. |
Example: We primarily used this tutorial to render ssr: With Babel configuration:
The current example doesn't use
|
ok that's great thanks, I'll try and find a moment to take a look |
I'm slightly confused - the repository you've linked there seems to work ok for me? I've got a couple of console errors but I think they're unrelated to the issues you're describing. At what point do you see the errors? What NodeJS version? |
We are using node version, That is weird if it's working for you, are you building then running the app using |
ah no I was running |
hi there,
|
Hi @daniele-zurico, |
@rhirani1 So you're issue is I think because lines like this:
are compiled and working correctly in your 99% sure that's you're issue. Just wondering what to actually do about it. |
I've run out of lunchtime now but will continue to mull this over. In the meantime you could maybe investigate what your options are in terms of running the SSR version from webpack-built copies. Without wanting to sound dismissive, I don't think this is an issue with the library - just how it's built in this specific express + react + whatever setup. NextJS has a solution for it (as in the ticket you linked to) - we just need to discover what the solution is for your setup. |
@rhirani1 It has occurred to me this morning that a previous iteration of my test suite actually used express in a very similar manner to how you are. In order to achieve this I did in fact compile the server code with webpack using this config: and then ran the server like this:
crucially this webpack config has the loaders set up to handle the image and ico files. Can you give this a try and let me know if this helps? If you don't get anywhere with it I will have a look at lunchtime and see if I can set the example repository up using this webpack config. |
@daniele-zurico unless you are also using express and doing server side rendering, the above suggested fix won't apply to you - we'll need to find a similar solution for whatever your setup is. Feel free to open a separate issue + example repository describing your specific problem. |
@andymantell That works! 🥳 Thank you very much, your a ⭐ |
ah awesome, glad I could help 😄 |
Hi
Similar to Compatibility with NextJS: #102
We face the same issue where it isn't able to load an image, the application has been created using create-react-app and using babel as the javascript compiler. But we see the below error during runtime:
Have you seen this issue before for Express Rendering, have also tried using webpack to bundle and transpile it using image loaders or file loaders. However had no luck. Any help would be appreciated.
The text was updated successfully, but these errors were encountered: