Skip to content
This repository was archived by the owner on Aug 20, 2018. It is now read-only.

Commit fd7433e

Browse files
SpaceK33zjoshwiens
authored andcommitted
docs: Incorporate feedback from other readme's
1 parent 8aa0828 commit fd7433e

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

README.md

+25-9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<h1>JSON Loader</h1>
1616
</div>
1717

18+
**Note: Since webpack v2, JSON files will work by default. You might still want to use this if you use a custom file extension.**
19+
1820
<h2 align="center">Install</h2>
1921

2022
```bash
@@ -23,29 +25,43 @@ npm install --save-dev json-loader
2325

2426
<h2 align="center">Usage</h2>
2527

26-
**require**
27-
```js
28-
const json = require("json!./file.json")
29-
```
3028

31-
**webpack.config.js**
32-
```js
33-
const json = require('file.json')
34-
```
29+
### Configuration (recommended)
3530

31+
**webpack.config.js**
3632
```js
3733
module.exports = {
3834
module: {
3935
rules: [
4036
{
4137
test: /\.json$/,
42-
use: [ 'json-loader' ]
38+
use: 'json-loader'
4339
}
4440
]
4541
}
4642
}
4743
```
4844

45+
```js
46+
import json from 'file.json';
47+
```
48+
49+
### CLI
50+
51+
```bash
52+
webpack --module-bind 'json=json-loader'
53+
```
54+
55+
```js
56+
import json from 'file.json';
57+
```
58+
59+
### Inline
60+
61+
```js
62+
import json from 'json-loader!file.json';
63+
```
64+
4965
<h2 align="center">Maintainer</h2>
5066

5167
<table>

0 commit comments

Comments
 (0)