Skip to content

Clarify code outside of defineBackground as related error #1569

@avi12

Description

@avi12

Feature Request

Suppose I have

// code
export default defineBackground(() => {
  // code
});

it will throw an error that doesn't clarify that I must not have code outside of defineBackground

Is your feature request related to a bug?

Not related to a particular bug, though this issue could be classified as a bug

What are the alternatives?

Knowledge of the situation according to the documentation, nothing else

Additional context

Having this issue clarified will benefit both WXT devs who are new to the framework and devs like me, who explore using an agentic AI to code the extension (e.g. OpenHands)
Such an agent can often use errors to modify the code so that the error disappears

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions