8000 docs: update installation and usage for modules · json5/json5@4798b9d · GitHub
[go: up one dir, main page]

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)
0