Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
browser-sync bs-config.js that will end the document.write errors in devTools
'use strict';
// var fallback = require('connect-history-api-fallback');
// var log = require('connect-logger');
/*
| For up-to-date information about the options:
| http://www.browsersync.io/docs/options/
*/
module.exports = {
port: 8085,
injectChanges: true,
watchOptions: {
ignored: ['node_modules', '.git'],
},
snippetOptions: {
rule: {
match: /<\/head>/u,
fn(snippet, match) {
const {
groups: { src },
} = /src='(?<src>[^']+)'/u.exec(snippet);
return `<script src="${src}" async></script>${match}`;
},
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment