Skip to content
Discussion options

You must be logged in to vote

Single Background File Limitation

You can import code from other files in your background, so no, it doesn't have to be a single file. You can also use a folder for the background and put related files in that folder, see https://wxt.dev/guide/essentials/entrypoints.html#background

// entrypoints/background/index.ts
import { initAlarms } from './alarms'
import { initMessaging } from './messaging'

export default define background(() => {
  initMessaging()
  initAlarms()
  // ...
})
// entrypoints/background/alarms.ts
export function initAlarms() {
  // ...
}
// entrypoints/background/messaging.ts
export function initMessaging() {
  // ...
}

Also see #1038, someone has opened an issue fo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by only-issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants