Hydrate Issue when setting up an Express subapp using mountpath
See original GitHub issueWhat version of Remix are you using?
1.5.1
Steps to Reproduce
I’ve created an example repo https://github.com/christophior/remix-express-mountpath-example
Steps include:
- create a basic Remix app using Express as the server
- update server.js to mount a subapp which will be used for our app
- update our remix.config.js so that our public path is updated to hit the new subpath
Expected Behavior
Application loads when hitting subpath instead of quickly flashing rendered page followed by a white page.
Actual Behavior
When you run the application and hit a route in the subpath, for instance /example
or /example/counter
you will see the page render for a split second before displaying a white page.
Currently my example repo shows the following error in the console:
Warning: Did not expect server HTML to contain a <script> in <html>.
but I have also seen the following error in another project:
Warning: Did not expect server HTML to contain a <div> in <div>.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
node.js - understanding app.mountpath property of express
The mountpath property simply contains the route pattern where a specific sub-app was mounted i.e. in the above example:
Read more >Express.js app.mountpath Property - GeeksforGeeks
The app.mountpath property contains one or more path patterns on which a sub-app was mounted. Syntax: app.mountpath.
Read more >Node.js and Express Tutorial: Build a Website Using Pug - Auth0
Learn how to use Express and the Pug template engine to build a website in Node.js. Create user interfaces using Pug and CSS...
Read more >How to use the app object in Express.js | by John Au-Yeung
mountpath property has one or more path patterns which the sub-app was mounted. A sub-app is an instance of express that's used for...
Read more >API Reference - Express 4.x
A sub-app is an instance of express that may be used for handling the request to ... Check out the query parser application...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I wouldn’t say this is hacky, rather it’s exactly why we expose lower level APIs like
createRequestHandler
in the first place. This isn’t an extremely common use-case, but it is something we want to enable if you are running your own server!Ok whatever you choose you need to make sure that Remix routes match the URL in the browser. That is you cannot do URL rewriting on the server.