We're currently in the process of rebuilding our company's application in Remix based upon the Grunge Stack. As part of this we use a number of external services including; Google Tag Manager, Intercom which require a simple JS script to be added, however when doing so, it results in a hydration failure.
This appears to be the same as https://github.com/remix-run/remix/discussions/3179.
We have investigated other approached and neither of the following alternative solve the problem:
- https://github.com/sergiodxa/remix-utils#externalscripts
- https://github.com/remix-run/examples/blob/main/google-analytics/app/root.tsx
I appreciate this is an ongoing issue, but is there any workaround to use an external script without causing hydration issues?
Note; The grunge stack is is deployed onto AWS Lambda & leverages React 18.