Skip to content

Commit 56b9aab

Browse files
committed
Update examples and README to reflect that the json-loader is not required anymore
1 parent 993aeab commit 56b9aab

8 files changed

Lines changed: 27 additions & 35 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ or are automatically applied via regex from your webpack configuration.
8585
Please see [Using Loaders](https://webpack.github.io/docs/using-loaders.html) for more information.
8686

8787
**basic**
88-
* [`json`](https://github.com/webpack/json-loader): Loads file as JSON
8988
* [`raw`](https://github.com/webpack/raw-loader): Loads raw content of a file (as utf-8)
9089
* [`val`](https://github.com/webpack/val-loader): Executes code as module and consider exports as JavaScript code
9190
* [`script`](https://github.com/webpack/script-loader): Executes a JavaScript file once in global context (like in script tag), requires are not parsed.

examples/loader/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// use our loader
55
console.dir(require("./loader!./file"));
66

7-
// use buildin json loader
8-
console.dir(require("./test.json")); // default by extension
9-
console.dir(require("!json!./test.json")); // manual
7+
// use buildin css loader
8+
console.dir(require("./test.css")); // default by extension
9+
console.dir(require("!css-loader!./test.css")); // manual
1010
```
1111

1212
# file.js
@@ -23,11 +23,11 @@ module.exports = function(content) {
2323
}
2424
```
2525

26-
# test.json
26+
# test.css
2727

28-
``` javascript
29-
{
30-
"foobar": 1234
28+
```css
29+
.some-class {
30+
color: hotpink;
3131
}
3232
```
3333

@@ -109,7 +109,7 @@ module.exports = function(content) {
109109
/* unknown exports provided */
110110
/* all exports used */
111111
/*!*******************************************!*\
112-
!*** (webpack)/~/json-loader!./test.json ***!
112+
!*** (webpack)/~/css-loader!./test.css ***!
113113
\*******************************************/
114114
/***/ function(module, exports) {
115115

@@ -141,9 +141,9 @@ exports.foo = "bar";
141141
// use our loader
142142
console.dir(__webpack_require__(/*! ./loader!./file */ 1));
143143

144-
// use buildin json loader
145-
console.dir(__webpack_require__(/*! ./test.json */ 0)); // default by extension
146-
console.dir(__webpack_require__(/*! json!./test.json */ 0)); // manual
144+
// use buildin css loader
145+
console.dir(__webpack_require__(/*! ./test.css */ 0)); // default by extension
146+
console.dir(__webpack_require__(/*! css-loader!./test.css */ 0)); // manual
147147

148148
/***/ }
149149
/******/ ]);
@@ -172,9 +172,9 @@ output.js 3.39 kB 0 [emitted] main
172172
Entrypoint main = output.js
173173
chunk {0} output.js (main) 278 bytes [entry] [rendered]
174174
> main [2] ./example.js
175-
[0] (webpack)/~/json-loader!./test.json 37 bytes {0} [built]
176-
cjs require !json!./test.json [2] ./example.js 6:12-40
177-
cjs require ./test.json [2] ./example.js 5:12-34
175+
[0] (webpack)/~/css-loader!./test.css 37 bytes {0} [built]
176+
cjs require !css!./test.css [2] ./example.js 6:12-40
177+
cjs require ./test.css [2] ./example.js 5:12-34
178178
[1] ./loader.js!./file.js 41 bytes {0} [built]
179179
cjs require ./loader!./file [2] ./example.js 2:12-38
180180
[2] ./example.js 200 bytes {0} [built]
@@ -191,9 +191,9 @@ output.js 638 bytes 0 [emitted] main
191191
Entrypoint main = output.js
192192
chunk {0} output.js (main) 278 bytes [entry] [rendered]
193193
> main [2] ./example.js
194-
[0] (webpack)/~/json-loader!./test.json 37 bytes {0} [built]
195-
cjs require !json!./test.json [2] ./example.js 6:12-40
196-
cjs require ./test.json [2] ./example.js 5:12-34
194+
[0] (webpack)/~/css-loader!./test.css 37 bytes {0} [built]
195+
cjs require !css-loader!./test.css [2] ./example.js 6:12-40
196+
cjs require ./test.css [2] ./example.js 5:12-34
197197
[1] ./loader.js!./file.js 41 bytes {0} [built]
198198
cjs require ./loader!./file [2] ./example.js 2:12-38
199199
[2] ./example.js 200 bytes {0} [built]

examples/loader/enhanced-require.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/loader/example.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// use our loader
22
console.dir(require("./loader!./file"));
33

4-
// use buildin json loader
5-
console.dir(require("./test.json")); // default by extension
6-
console.dir(require("!json-loader!./test.json")); // manual
4+
// use buildin css loader
5+
console.dir(require("./test.css")); // default by extension
6+
console.dir(require("!css-loader!./test.css")); // manual

examples/loader/template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
{{loader.js}}
1717
```
1818

19-
# test.json
19+
# test.css
2020

2121
``` javascript
22-
{{test.json}}
22+
{{test.css}}
2323
```
2424

2525
# js/output.js

examples/loader/test.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.some-class {
2+
color: hotpink;
3+
}

examples/loader/test.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/loader/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
module: {
33
loaders: [
4-
{ test: /\.json$/, loader: "json-loader" }
4+
{ test: /\.css$/, loader: "css-loader" }
55
]
66
}
7-
}
7+
};

0 commit comments

Comments
 (0)