Skip to content

Commit 4798b9d

Browse files
committed
docs: update installation and usage for modules
1 parent 43042bd commit 4798b9d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,29 @@ specification](https://json5.github.io/json5-spec/).
7878
npm install json5
7979
```
8080

81-
### CommonJS
81+
#### CommonJS
8282
```js
8383
const JSON5 = require('json5')
8484
```
8585

86-
### Modules
86+
#### Modules
8787
```js
8888
import JSON5 from 'json5'
8989
```
9090

9191
### Browsers
92+
#### UMD
9293
```html
94+
<!-- This will create a global `JSON5` variable. -->
9395
<script src="https://unpkg.com/json5@2/dist/index.min.js"></script>
9496
```
9597

96-
This will create a global `JSON5` variable.
98+
#### Modules
99+
```html
100+
<script type="module">
101+
import JSON5 from 'https://unpkg.com/json5@2/dist/index.min.mjs'
102+
</script>
103+
```
97104

98105
## API
99106
The JSON5 API is compatible with the [JSON API].

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy