Once built and hosted - visiting any route other than the homepage and refreshing the page (or pressing back) will first redirect to the homepage, then load the route/url you want, and CSS will then be broken.
The url will be: domain.com/about_us/contact_us (which is 3 components deep, 1. homepage 2. about us and 3. contact us)
Refresh the page with f5 or press the back button to go to about us
URL shows the correct url, but homepage loads first, then the route loads, and the CSS is then broken.
Same results if just copy and pasting the URL and visiting a nested route directly.
Cannot link to reproducible as its a private app not released.
Using standard react-router routes where domain.com/about_us would direct to the about_us component.
Error: Unable to find a place to inject the manifest. Please ensure that your service worker file contains the following: self.__WB_MANIFEST
at Object.injectManifest
Additional context/Screenshots
React Scripts:
(with trying to use custom service worker, it still causes issues with or without the build-sw script)
The issue was the workbox-build version was incorrect for the code I was using. Downgrading the version to 3.5.0 in the package.json worked and fixed the issue.
Bug Report
Current Behavior
Once built and hosted - visiting any route other than the homepage and refreshing the page (or pressing back) will first redirect to the homepage, then load the route/url you want, and CSS will then be broken.
Same results if just copy and pasting the URL and visiting a nested route directly.
Cannot link to reproducible as its a private app not released.
Using standard react-router routes where domain.com/about_us would direct to the about_us component.
Possible Solution
Trying to set a custom serviceworker to use 200.html as the index page - but currently get this issue: https://stackoverflow.com/questions/62736986/serviceworker-workbox-v3-5-unable-to-find-a-place-to-inject-the-manifest-in
Additional context/Screenshots
React Scripts:
(with trying to use custom service worker, it still causes issues with or without the build-sw script)
Npm run build results in React-Snap error:
How can we fix this? I can't believe I'm the only one having this issue with react-router being so popular?