You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 20, 2018. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+14-24
Original file line number
Diff line number
Diff line change
@@ -21,47 +21,36 @@
21
21
npm install --save-dev json-loader
22
22
```
23
23
24
-
⚠️ **Note: Since webpack v2, importing of JSON files will work by default. You might still want to use this if you use a custom file extension.**
24
+
> ⚠️ **Since `webpack >= v2.0.0`, importing of JSON files will work by default. You might still want to use this if you use a custom file extension. See the [v1.0.0 -> v2.0.0 Migration Guide](https://webpack.js.org/guides/migrating/#json-loader-is-not-required-anymore) for more information**
25
25
26
26
<h2align="center">Usage</h2>
27
27
28
+
### `Inline`
28
29
29
-
### Configuration (recommended)
30
+
```js
31
+
constjson=require('json-loader!./file.json');
32
+
```
33
+
34
+
### `Configuration` (recommended)
35
+
36
+
```js
37
+
constjson=require('./file.json');
38
+
```
30
39
31
40
**webpack.config.js**
32
41
```js
33
42
module.exports= {
34
43
module: {
35
-
rules: [
44
+
loaders: [
36
45
{
37
46
test:/\.json$/,
38
-
use:'json-loader'
47
+
loader:'json-loader'
39
48
}
40
49
]
41
50
}
42
51
}
43
52
```
44
53
45
-
```js
46
-
importjsonfrom'file.json';
47
-
```
48
-
49
-
### CLI
50
-
51
-
```bash
52
-
webpack --module-bind 'json=json-loader'
53
-
```
54
-
55
-
```js
56
-
importjsonfrom'file.json';
57
-
```
58
-
59
-
### Inline
60
-
61
-
```js
62
-
importjsonfrom'json-loader!file.json';
63
-
```
64
-
65
54
<h2align="center">Maintainer</h2>
66
55
67
56
<table>
@@ -76,6 +65,7 @@ import json from 'json-loader!file.json';
0 commit comments