Open
Description
Describe the bug
While npx wxt prepare
generates the types folder, it doesn't generate types for browser.runtime.getURL
for the unlisted css (documentation).
Also, i noticed that there is an error in the description of the documentation about unlisted css.
entrypoints/{name}.(css|scss|sass|less|styl|stylus)
will generates /assets/{name}.css
, not /{name}.css
.
Reproduction
This is a reproduction to inject css file into main world.
/entrypoints/main-world.css
is the target css file will be injected into the main world.
injectCss(browser.runtime.getURL('/assets/main-world.css'))
// injectCss just creates the link element and insert into document head
The generated types for the browser.runtime.getURL
looks like:
declare module "wxt/browser" {
export type PublicPath =
| ""
| "/"
| "/background.js"
| "/content-scripts/mycontent.js"
| "/icons/128.png"
| "/icons/16.png"
| "/icons/32.png"
| "/icons/48.png"
| "/inject.js"
type HtmlPublicPath = Extract<PublicPath, `${string}.html`>
export interface WxtRuntime {
getURL(path: PublicPath): string;
getURL(path: `${HtmlPublicPath}${string}`): string;
}
}
The unlisted script (inject.js) is properly generated, but unlisted css is not.
Steps to reproduce
No response
System Info
System:
OS: Windows 10 10.0.19045
CPU: (6) x64 Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz
Memory: 14.48 GB / 31.83 GB
Binaries:
Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.10.0 - ~\AppData\Local\pnpm\pnpm.CMD
Browsers:
Edge: Chromium (133.0.3065.69)
Internet Explorer: 11.0.19041.4355
npmPackages:
wxt: ^0.20.0 => 0.20.6
Used Package Manager
pnpm
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.