File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 5
5
var path = require ( "path" ) ;
6
6
var fs = require ( "fs" ) ;
7
7
var loaderUtils = require ( "loader-utils" ) ;
8
+ var jsesc = require ( "jsesc" ) ;
8
9
var NodeTemplatePlugin = require ( "webpack/lib/node/NodeTemplatePlugin" ) ;
9
10
var NodeTargetPlugin = require ( "webpack/lib/node/NodeTargetPlugin" ) ;
10
11
var LibraryTemplatePlugin = require ( "webpack/lib/LibraryTemplatePlugin" ) ;
@@ -130,12 +131,14 @@ module.exports.pitch = function(request) {
130
131
if ( text . locals ) {
131
132
resultSource += "\nmodule.exports = " + JSON . stringify ( text . locals ) + ";" ;
132
133
}
134
+
133
135
// module.hot.data is undefined on initial load, and an object in hot updates
136
+ var jsescOpts = { wrap : true , quotes : "double" } ;
134
137
resultSource += `
135
- /*__START_CSS__*/
136
- var moduleId = " ${ text [ 0 ] [ 0 ] } " ;
137
- var css = " ${ text [ 0 ] [ 1 ] . split ( "\n" ) . join ( "" ) } ";
138
- var addStyles = require("style-loader/addStyles.js");
138
+ /*__START_CSS__*/
139
+ var moduleId = ${ jsesc ( text [ 0 ] [ 0 ] , jsescOpts ) } ;
140
+ var css = ${ jsesc ( text [ 0 ] [ 1 ] , jsescOpts ) } ;
141
+ var addStyles = require("style-loader/addStyles.js");
139
142
addStyles([[moduleId, css]], "");
140
143
/*__END_CSS__*/
141
144
Original file line number Diff line number Diff line change 22
22
"dependencies" : {
23
23
"ajv" : " ^4.11.2" ,
24
24
"async" : " ^2.1.2" ,
25
+ "jsesc" : " ^2.5.1" ,
25
26
"loader-utils" : " ^1.0.2" ,
26
27
"style-loader" : " ^0.16.1" ,
27
28
"webpack-sources" : " ^0.2.3"
You can’t perform that action at this time.
0 commit comments