Generated script constants
Open
@nickbar01234 is already working on this.
Since Feb 11, 2026.
contribution welcome
good first issue
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 564
- PR merge metrics
- No merged PRs in 30d
Description
Feature Request
A common pattern is to define a content script and dynamically injecting script at runtime via
// script.ts
export default defineUnlistedScript(() => { console.log("Hello" });
// background.ts
browser.scripting.executeScript({ file: ["/script.js"] })
If the filename were to change, the user would also need to update the path used in executeScript. Curious on whether it's feasible to generate a constant enum specifying the filename. The API can look something like
export default defineUnlistedScript({
name: "MyDynamicScript"
main: () => { ... }
}
// background.ts
browser.scripting.executeScript({ file: [Scripts["MyDynamicScript"]] });
the value would map to the actual path.
Is your feature request related to a bug?
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.