Skip to content

Commit

Permalink
Update examples and README to reflect that the json-loader is not req…
Browse files Browse the repository at this point in the history
…uired anymore
  • Loading branch information
jhnns committed Dec 7, 2016
1 parent 993aeab commit 56b9aab
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 35 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -85,7 +85,6 @@ or are automatically applied via regex from your webpack configuration.
Please see [Using Loaders](https://webpack.github.io/docs/using-loaders.html) for more information.

**basic**
* [`json`](https://github.com/webpack/json-loader): Loads file as JSON
* [`raw`](https://github.com/webpack/raw-loader): Loads raw content of a file (as utf-8)
* [`val`](https://github.com/webpack/val-loader): Executes code as module and consider exports as JavaScript code
* [`script`](https://github.com/webpack/script-loader): Executes a JavaScript file once in global context (like in script tag), requires are not parsed.
Expand Down
34 changes: 17 additions & 17 deletions examples/loader/README.md
Expand Up @@ -4,9 +4,9 @@
// use our loader
console.dir(require("./loader!./file"));

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

# file.js
Expand All @@ -23,11 +23,11 @@ module.exports = function(content) {
}
```

# test.json
# test.css

``` javascript
{
"foobar": 1234
```css
.some-class {
color: hotpink;
}
```

Expand Down Expand Up @@ -109,7 +109,7 @@ module.exports = function(content) {
/* unknown exports provided */
/* all exports used */
/*!*******************************************!*\
!*** (webpack)/~/json-loader!./test.json ***!
!*** (webpack)/~/css-loader!./test.css ***!
\*******************************************/
/***/ function(module, exports) {

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

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

/***/ }
/******/ ]);
Expand Down Expand Up @@ -172,9 +172,9 @@ output.js 3.39 kB 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 278 bytes [entry] [rendered]
> main [2] ./example.js
[0] (webpack)/~/json-loader!./test.json 37 bytes {0} [built]
cjs require !json!./test.json [2] ./example.js 6:12-40
cjs require ./test.json [2] ./example.js 5:12-34
[0] (webpack)/~/css-loader!./test.css 37 bytes {0} [built]
cjs require !css!./test.css [2] ./example.js 6:12-40
cjs require ./test.css [2] ./example.js 5:12-34
[1] ./loader.js!./file.js 41 bytes {0} [built]
cjs require ./loader!./file [2] ./example.js 2:12-38
[2] ./example.js 200 bytes {0} [built]
Expand All @@ -191,9 +191,9 @@ output.js 638 bytes 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 278 bytes [entry] [rendered]
> main [2] ./example.js
[0] (webpack)/~/json-loader!./test.json 37 bytes {0} [built]
cjs require !json!./test.json [2] ./example.js 6:12-40
cjs require ./test.json [2] ./example.js 5:12-34
[0] (webpack)/~/css-loader!./test.css 37 bytes {0} [built]
cjs require !css-loader!./test.css [2] ./example.js 6:12-40
cjs require ./test.css [2] ./example.js 5:12-34
[1] ./loader.js!./file.js 41 bytes {0} [built]
cjs require ./loader!./file [2] ./example.js 2:12-38
[2] ./example.js 200 bytes {0} [built]
Expand Down
7 changes: 0 additions & 7 deletions examples/loader/enhanced-require.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions examples/loader/example.js
@@ -1,6 +1,6 @@
// use our loader
console.dir(require("./loader!./file"));

// use buildin json loader
console.dir(require("./test.json")); // default by extension
console.dir(require("!json-loader!./test.json")); // manual
// use buildin css loader
console.dir(require("./test.css")); // default by extension
console.dir(require("!css-loader!./test.css")); // manual
4 changes: 2 additions & 2 deletions examples/loader/template.md
Expand Up @@ -16,10 +16,10 @@
{{loader.js}}
```

# test.json
# test.css

``` javascript
{{test.json}}
{{test.css}}
```

# js/output.js
Expand Down
3 changes: 3 additions & 0 deletions examples/loader/test.css
@@ -0,0 +1,3 @@
.some-class {
color: hotpink;
}
3 changes: 0 additions & 3 deletions examples/loader/test.json

This file was deleted.

4 changes: 2 additions & 2 deletions examples/loader/webpack.config.js
@@ -1,7 +1,7 @@
module.exports = {
module: {
loaders: [
{ test: /\.json$/, loader: "json-loader" }
{ test: /\.css$/, loader: "css-loader" }
]
}
}
};

0 comments on commit 56b9aab

Please sign in to comment.