|
2 | 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
3 | 3 | Author Tobias Koppers @sokra
|
4 | 4 | */
|
5 |
| -var path = require("path"); |
| 5 | +var loaderUtils = require("loader-utils"), |
| 6 | + path = require("path"); |
6 | 7 | module.exports = function() {};
|
7 | 8 | module.exports.pitch = function(remainingRequest) {
|
8 | 9 | this.cacheable && this.cacheable();
|
9 | 10 | return [
|
10 | 11 | "// style-loader: Adds some reference to a css file to the DOM by adding a <link> tag",
|
11 | 12 | "var update = require(" + JSON.stringify("!" + path.join(__dirname, "addStyleUrl.js")) + ")(",
|
12 |
| - "\trequire(" + JSON.stringify("!!" + remainingRequest) + ")", |
| 13 | + "\trequire(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ")", |
13 | 14 | ");",
|
14 | 15 | "// Hot Module Replacement",
|
15 | 16 | "if(module.hot) {",
|
16 |
| - "\tmodule.hot.accept(" + JSON.stringify("!!" + remainingRequest) + ", function() {", |
17 |
| - "\t\tupdate(require(" + JSON.stringify("!!" + remainingRequest) + "));", |
| 17 | + "\tmodule.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ", function() {", |
| 18 | + "\t\tupdate(require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + "));", |
18 | 19 | "\t});",
|
19 | 20 | "\tmodule.hot.dispose(function() { update(); });",
|
20 | 21 | "}"
|
|
0 commit comments