Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Breaking change in 2.29 (removed document.write) #2031

Closed
pySilver opened this issue Apr 14, 2023 · 2 comments
Closed

[BUG] Breaking change in 2.29 (removed document.write) #2031

pySilver opened this issue Apr 14, 2023 · 2 comments

Comments

@pySilver
Copy link

In some configurations it is required to append browsersync snippet into <head> instead of <body>. We are doing that in environment where <body> is being swapped during internal navigation. It is typical html-over-the-wire approach for webapps.

What we used to do is leveraging this option https://browsersync.io/docs/options#option-snippetOptions

snippetOptions: {
    rule: {
      match: /<\/head>/i,
      fn: function (snippet, match) {
        return snippet + match;
      },
    },
  },

it worked perfectly. But with 2.29 release it appends an inline script that in turn appends client to <body> which seems to be hardcoded.

Proposed resolution: an option where to append snippet and client.

@shakyShane
Copy link
Contributor

Hi! Yeah this is a bug - the intention was only to remove document.write, whilst maintaining support for other options.

Thanks for the report, I'll address it soon :)

@shakyShane
Copy link
Contributor

@pySilver please try browser-sync@2.29.3 and let me know if you have any further issues :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants