File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ published: 2024-08-09
99tags :
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
7980To make ` example.js ` work in the browser,
8081you 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
8487npm init --yes
@@ -95,7 +98,12 @@ Now, open `index.html` in a browser.
9598When you open the console of your developer tools,
9699you 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/
You can’t perform that action at this time.
0 commit comments