Xiphe / remix-island

utils to render remix into a dom-node instead of the whole document
MIT License
126 stars 7 forks source link

bootstrapScriptContent bug #4

Closed 0Lucifer0 closed 1 year ago

0Lucifer0 commented 1 year ago

Hi, this is more an info / documentation for the next person having the problem.

It seems like there are bugs when using this alongside bootstrapScriptContent with a script like raygun.

  !function(a,b,c,d,e,f,g,h){a.RaygunObject=e,a[e]=a[e]||function(){
  (a[e].o=a[e].o||[]).push(arguments)},f=b.createElement(c),g=b.getElementsByTagName(c)[0],
  f.async=1,f.src=d,g.parentNode.insertBefore(f,g),h=a.onerror,a.onerror=function(b,c,d,f,g){
  h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({
  e:g})}}(window,document,"script","//cdn.raygun.io/raygun4js/raygun.min.js","rg4js");

This seems to be resolved by adding bootstrapScriptContent in the head (note i'm having a nonce here so need to remove it if not using csp nonce)

<script nonce="${nonce}">${bootstrapScriptContent}</script>${head}</head>
Xiphe commented 1 year ago

Makes sense! Thanks for reporting. I added this to the "pitfalls" section of the readme. (ref https://github.com/Xiphe/remix-island/commit/3750578a634d1c59b14929b85f7230abf91c83a8)