tl;dr
How can the manifest.json
be made accessible from any route within a React application (react-scripts)?
Context
I'm working on an app that was built to work in evergreen browsers; however, I now have to also make it possible to use the app in an Electron container that's maintained externally and whose instance can't be accessed from the app. Several of the app's links are intended to open in a new tab or window. When opened from Electron, the container attempts to find the manifest.json
from the pathname, but often can't do so because the manifest.json
is only accessible at the base.
Question
How can the manifest.json
be made accessible from any route within a React application(react-scripts)? For example, the manifest.json
should be accessible from any of the following routes:
/mainfest.json
/foo/manifest.json
/foo/bar/manifest.json
/foo/bar/baz/manifest.json
Attempts
- setupProxy.js using
**/manifest.json
(works in development, but not in production); <Route path="/:a(.+)/manifest.json}" render={() => ?}>
, but couldn't figure out what to add as the render prop;ReactDOM.render(window.location.pathname.includes('manifest.json') ? %PUBLIC_URL%/manifest.json : <Provider ... />)