Skip to content

Commit 61e6149

Browse files
committed
Add paragraph on browser support
1 parent c28ed54 commit 61e6149

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

doc/learn/unified-in-the-browser.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ published: 2024-08-09
99
tags:
1010
- browser
1111
- dom
12+
- esbuild
1213
- hast
1314
- mdast
1415
- nlcst
@@ -78,7 +79,9 @@ And you want to use that in some HTML called `index.html`:
7879

7980
To make `example.js` work in the browser,
8081
you can bundle it with esbuild.
81-
First, set up a package:
82+
First,
83+
set up a package.
84+
Go to the folder in your terminal and run:
8285

8386
```sh
8487
npm init --yes
@@ -95,7 +98,12 @@ Now, open `index.html` in a browser.
9598
When you open the console of your developer tools,
9699
you should see `Hello, <em>world</em>!`
97100

98-
That’s it!
101+
You probably also want to configure the target environment for the browsers
102+
that you support.
103+
That way,
104+
JavaScript syntax which is too new for some browsers,
105+
will be transformed into older JavaScript syntax that works.
106+
Pass the [`--target`][esbuild-target] flag to do this.
99107

100108
### CDN
101109

@@ -134,4 +142,6 @@ you can use it in a browser like this:
134142

135143
[esbuild]: https://esbuild.github.io/
136144

145+
[esbuild-target]: https://esbuild.github.io/api/#target
146+
137147
[esmsh]: https://esm.sh/

0 commit comments

Comments
 (0)