Skip to content

Commit 8cb2835

Browse files
committed
Merge pull request webpack-contrib#52 from zxcabs/stringifyRequest
Use loaderUtils#stringifyRequest
2 parents 9f565cb + 7526b57 commit 8cb2835

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

url.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
var path = require("path");
5+
var loaderUtils = require("loader-utils"),
6+
path = require("path");
67
module.exports = function() {};
78
module.exports.pitch = function(remainingRequest) {
89
this.cacheable && this.cacheable();
910
return [
1011
"// style-loader: Adds some reference to a css file to the DOM by adding a <link> tag",
1112
"var update = require(" + JSON.stringify("!" + path.join(__dirname, "addStyleUrl.js")) + ")(",
12-
"\trequire(" + JSON.stringify("!!" + remainingRequest) + ")",
13+
"\trequire(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ")",
1314
");",
1415
"// Hot Module Replacement",
1516
"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) + "));",
1819
"\t});",
1920
"\tmodule.hot.dispose(function() { update(); });",
2021
"}"

useable.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
var path = require("path");
5+
var loaderUtils = require("loader-utils"),
6+
path = require("path");
67
module.exports = function() {};
78
module.exports.pitch = function(remainingRequest) {
89
this.cacheable && this.cacheable();
@@ -11,7 +12,7 @@ module.exports.pitch = function(remainingRequest) {
1112
"var dispose;",
1213
"exports.use = exports.ref = function() {",
1314
" if(!(refs++)) {",
14-
" var content = require(" + JSON.stringify("!!" + remainingRequest) + ")",
15+
" var content = require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ")",
1516
" if(typeof content === 'string') content = [[module.id, content, '']];",
1617
" dispose = require(" + JSON.stringify("!" + path.join(__dirname, "addStyles.js")) + ")(content);",
1718
" }",

0 commit comments

Comments
 (0)