index.js
function injectSWRegister(data) {
  let swHtml = `<script>${compiledSWRegTpl}</script></body>`;

  if (data.indexOf(compiledSWRegTpl) === -1) {
    data = data.replace('</body>', swHtml);
  }

  return data;
}
function injectSWRegister(data) {
  let swHtml = `<script>${compiledSWRegTpl}</script></body>`;

  if (data.indexOf(compiledSWRegTpl) === -1) {
    data = data.replace('</body>', swHtml);
  }

  return data;
}
inject service worker registion fragment into page code

@param {string} data html
@return {string}