diff --git a/scripts/build.js b/scripts/build.js index 633c841..a099126 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -56,8 +56,7 @@ async function build() { const assets = new AssetMap(targetDir); const imageAssets = await copyFolder(path.join(projectDir, "images"), path.join(targetDir, "images")); assets.addSubMap(imageAssets); - await assets.write(`bundle-esm.js`, await buildJs("src/main.js", assets)); - await assets.write(`bundle-legacy.js`, await buildJsLegacy("src/main.js", assets, ["src/polyfill.js"])); + await assets.write(`bundle.js`, await buildJsLegacy("src/main.js", assets, ["src/polyfill.js"])); await assets.write(`bundle.css`, await buildCss("css/main.css", targetDir, assets)); await assets.writeUnhashed(".well-known/apple-app-site-association", buildAppleAssociatedAppsFile(createClients())); await assets.writeUnhashed("index.html", await buildHtml(assets)); @@ -70,9 +69,8 @@ async function buildHtml(assets) { const doc = cheerio.load(devHtml); doc("link[rel=stylesheet]").attr("href", assets.resolve(`bundle.css`)); const mainScripts = [ - ``, - ``, - `` + ``, + `` ]; doc("script#main").replaceWith(mainScripts.join("")); return doc.html(); @@ -86,19 +84,6 @@ function createReplaceUrlPlugin(assets) { return replace(replacements); } -async function buildJs(mainFile, assets, extraFiles = []) { - // create js bundle - const bundle = await rollup({ - input: extraFiles.concat(mainFile), - plugins: [multi(), terser(), createReplaceUrlPlugin(assets)], - }); - const {output} = await bundle.generate({ - format: 'es', - }); - const code = output[0].code; - return code; -} - async function buildJsLegacy(mainFile, assets, extraFiles = []) { // compile down to whatever IE 11 needs const babelPlugin = babel.babel({