diff --git a/packages/wxt-demo/src/entrypoints/background.ts b/packages/wxt-demo/src/entrypoints/background.ts index a8996acc8..096261015 100644 --- a/packages/wxt-demo/src/entrypoints/background.ts +++ b/packages/wxt-demo/src/entrypoints/background.ts @@ -14,12 +14,13 @@ export default defineBackground({ console.log(useAppConfig()); - // @ts-expect-error: should only accept entrypoints or public assets browser.runtime.getURL('/'); browser.runtime.getURL('/background.js'); browser.runtime.getURL('/icons/128.png'); browser.runtime.getURL('/example.html#hash'); browser.runtime.getURL('/example.html?query=param'); + // @ts-expect-error: should only accept entrypoints or public assets + browser.runtime.getURL('/unknown'); // @ts-expect-error: should only allow hashes/query params on HTML files browser.runtime.getURL('/icon-128.png?query=param'); diff --git a/packages/wxt/e2e/tests/typescript-project.test.ts b/packages/wxt/e2e/tests/typescript-project.test.ts index 34c372af6..167e01f8b 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" | "/sandbox.html" diff --git a/packages/wxt/src/core/generate-wxt-dir.ts b/packages/wxt/src/core/generate-wxt-dir.ts index cf9980c7f..a96c6353f 100644 --- a/packages/wxt/src/core/generate-wxt-dir.ts +++ b/packages/wxt/src/core/generate-wxt-dir.ts @@ -78,6 +78,7 @@ async function getPathsDeclarationEntry( isHtmlEntrypoint(entry) ? '.html' : '.js', ), ) + .concat(['']) .concat(await getPublicFiles()); await wxt.hooks.callHook('prepare:publicPaths', wxt, paths);