diff --git a/packages/wxt/e2e/tests/typescript-project.test.ts b/packages/wxt/e2e/tests/typescript-project.test.ts index 4e32a383e..35d35a6aa 100644 --- a/packages/wxt/e2e/tests/typescript-project.test.ts +++ b/packages/wxt/e2e/tests/typescript-project.test.ts @@ -48,6 +48,7 @@ describe('TypeScript Project', () => { declare module "wxt/browser" { export type PublicPath = + | "" | "/" | "/options.html" | "/popup.html" diff --git a/packages/wxt/src/core/generate-wxt-dir.ts b/packages/wxt/src/core/generate-wxt-dir.ts index b6871b8c5..ad7aeb2ef 100644 --- a/packages/wxt/src/core/generate-wxt-dir.ts +++ b/packages/wxt/src/core/generate-wxt-dir.ts @@ -73,16 +73,18 @@ async function getPathsDeclarationEntry( isHtmlEntrypoint(entry) ? '.html' : '.js', ), ) - .concat(['']) .concat(await getPublicFiles()); await wxt.hooks.callHook('prepare:publicPaths', wxt, paths); - const unions = paths - .map(normalizePath) - .sort() - .map((path) => ` | "/${path}"`) - .join('\n'); + const unions = [ + ` | ""`, + ` | "/"`, + ...paths + .map(normalizePath) + .sort() + .map((path) => ` | "/${path}"`), + ].join('\n'); const template = `// Generated by wxt import "wxt/browser";