Skip to content

Commit dc770b5

Browse files
authored
docs: Update ESM docs to clearify that it covers configuring ESM at runtime
1 parent 8cd2bff commit dc770b5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

docs/guide/essentials/es-modules.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# ES Modules
22

3-
Currently, ESM entrypoints are opt-in, so you must configure each entrypoint with that in mind.
3+
You source code should always be written as ESM. However, you have some control whether an entrypoint is bundled as ESM.
44

55
## HTML Pages <Badge type="warning" text="≥0.0.1" />
66

7-
In general, you should always make HTML pages import ESM scripts, unless you need to support old browsers.
8-
9-
To make a script ESM, add `type="module"`:
7+
Vite only supports bundling JS from HTML pages as ESM. Ensure you have added `type="module"` to your `<script>` tags:
108

119
<!-- prettier-ignore -->
1210
```html
@@ -33,6 +31,6 @@ Only MV3 supports ESM background scripts/service workers. When targeting MV2, th
3331

3432
## Content Scripts
3533

36-
WXT does not yet include built-in support for ESM content scripts. The plan is to add support for chunking to reduce bundle size, but not support HMR for now. There are several technical issues that make implementing a generic solution for HMR impossible. See [Content Script ESM Support #357](https://github.com/wxt-dev/wxt/issues/357) for details.
34+
WXT does not yet include built-in support for bundling content scripts as ESM. The plan is to add support for chunking to reduce bundle size, but not support HMR for now. There are several technical issues that make implementing a generic solution for HMR impossible. See [Content Script ESM Support #357](https://github.com/wxt-dev/wxt/issues/357) for details.
3735

38-
If you can't wait, and need ESM support right now, you can implement ESM support manually. See the [ESM Content Script UI](https://github.com/wxt-dev/examples/tree/main/examples/esm-content-script-ui) example to get started.
36+
If you can't wait, and need ESM support right now, you can implement ESM support manually. See the [ESM Content Script UI](https://github.com/wxt-dev/examples/tree/main/examples/esm-content-script-ui) example to learn how.

0 commit comments

Comments
 (0)