Skip to content

Commit 0d56100

Browse files
authored
docs: Fix wording around ESM background scripts
1 parent dc770b5 commit 0d56100

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/guide/essentials/es-modules.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Vite only supports bundling JS from HTML pages as ESM. Ensure you have added `ty
1414

1515
## Background <Badge type="warning" text="≥0.16.0" />
1616

17-
In your background script, set `type: "module"`:
17+
By default, your background will be bundled into a single file as IIFE. You can change this by setting `type: "module"` in your background entrypoint:
1818

1919
```ts
2020
export default defineBackground({
@@ -25,6 +25,8 @@ export default defineBackground({
2525
});
2626
```
2727

28+
This will change the output format to ESM, enable code-spliting between your background script and HTML pages, and set `"type": "module"` in your manifest.
29+
2830
:::warning
2931
Only MV3 supports ESM background scripts/service workers. When targeting MV2, the `type` option is ignored and the background is always bundled into a single file as IIFE.
3032
:::

0 commit comments

Comments
 (0)