packages/building-rollup/plugins/rollup-plugin-modern-web/rollup-plugin-modern-web.js
function getOutputHTML(dir) {
  if (existsSync(`${dir}/index.html`)) {
    return readHTML(`${dir}/index.html`);
  }

  const outputHTML = readHTML(inputIndexHTMLPath);
  const scripts = queryAll(outputHTML, predicates.hasTagName('script'));
  const moduleScripts = scripts.filter(script => getAttribute(script, 'type') === 'module');
  moduleScripts.forEach(moduleScript => {
    remove(moduleScript);
  });

  writeOutputHTML(dir, outputHTML);
  return outputHTML;
}
function getOutputHTML(dir) {
  if (existsSync(`${dir}/index.html`)) {
    return readHTML(`${dir}/index.html`);
  }

  const outputHTML = readHTML(inputIndexHTMLPath);
  const scripts = queryAll(outputHTML, predicates.hasTagName('script'));
  const moduleScripts = scripts.filter(script => getAttribute(script, 'type') === 'module');
  moduleScripts.forEach(moduleScript => {
    remove(moduleScript);
  });

  writeOutputHTML(dir, outputHTML);
  return outputHTML;
}
function getOutputHTML ( dir ) { if ( existsSync ( ` ${ dir } ` ) ) { return readHTML ( ` ${ dir } ` ) ; } const outputHTML = readHTML ( inputIndexHTMLPath ) ; const scripts = queryAll ( outputHTML , predicates . hasTagName ( 'script' ) ) ; const moduleScripts = scripts . filter ( script => getAttribute ( script , 'type' ) === 'module' ) ; moduleScripts . forEach ( moduleScript => { remove ( moduleScript ) ; } ) ; writeOutputHTML ( dir , outputHTML ) ; return outputHTML ; }
Gets the output HTML as AST. Rollup might run with multiple outputs, but there should be only one index.html output. Therefore we check if it wasn't already created before. If there is no index.html yet, we copy over the input index.html with the original module scripts removed.
Gets the output HTML as AST . Rollup might run with multiple outputs but there should be only one index . html output . Therefore we check if it wasn t already created before . If there is no index . html yet we copy over the input index . html with the original module scripts removed .