From 9b20f310f9e6eabe112ff12294503b3107de55b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADnez?= Date: Fri, 20 Jan 2023 18:09:26 +0100 Subject: [PATCH 01/25] Update README.md Fixes #11 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 121d76c..7719010 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ esbuild.build({ generateHTML: "src/index.html" // Or: generateHTML: { - originalFile: "src/index.html", + sourceFile: "src/index.html", pathPrefix: "assets/", preload: [{ href: "https://example.com/my-external.css", as: "stylesheet" }] } From 67c705802c4f416f7ab95e44331d13c11c00b3a1 Mon Sep 17 00:00:00 2001 From: philip ross Date: Tue, 24 Jan 2023 11:49:50 +0000 Subject: [PATCH 02/25] add support for script src imports --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 80f5ce9..eaec61e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -139,7 +139,8 @@ const vuePlugin = (opts: Options = {}) => { let code = ""; if (descriptor.script || descriptor.scriptSetup) { - code += `import script from "${encPath}?type=script";` + const src = (descriptor.script && !descriptor.scriptSetup && descriptor.script.src) || encPath + code += `import script from "${src}?type=script";` } else { code += "const script = {};" } From 5d0de7cd64591521671dde72e0ac483ae50c6bb4 Mon Sep 17 00:00:00 2001 From: philip ross Date: Wed, 25 Jan 2023 10:38:05 +0000 Subject: [PATCH 03/25] Fix generate html insert script assets once --- src/html.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/html.ts b/src/html.ts index 0a74d87..3ce4c98 100644 --- a/src/html.ts +++ b/src/html.ts @@ -63,7 +63,7 @@ export async function generateIndexHTML(result: BuildResult, opts: IndexOptions, link.attr("rel", item.prefetch ? "prefetch" : "preload"); link.attr("href", item.href); link.attr("as", item.as); - link.insertAfter($("head :last-child")) + $("head").append(link) } } @@ -83,11 +83,12 @@ export async function generateIndexHTML(result: BuildResult, opts: IndexOptions, if (ext === ".js") { const script = $("