wxt-dev / wxt-dev/wxt

Passing an UnlistedScriptDefinition to injectScript

Open
#1,754 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Feature Request

It would be nice if the build system substituted the path of the script in the injectScript call as follows.

// main-injected.ts
export default defineUnlistedScript(/* ... */);
// isolated.content.ts
import mainInjected from "./main-injected";

export default defineContentScript({
  matches: ["https://example.net/*"],
  async main() {
    await injectScript(mainInjected);
  },
});

Thanks!

Is your feature request related to a bug?

N/A

What are the alternatives?

Keeping things as-is.

Additional context

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the build-system handling of the injectScript call and the UnlistedScriptDefinition returned by defineUnlistedScript; the issue does not name specific files or tests. Compare the main-injected.ts and isolated.content.ts examples, and consider the work complete when the build substitutes the script path for injectScript(mainInjected).

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.