Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit c972c92

Browse files
bmeurerjoshwiens
authored andcommitted
fix: escape newline/paragraph separators (#36)
Similar to webpack-contrib/json-loader#18 the `raw-loader` also needs to properly escape the special unicode characters, as otherwise `webpack` get's highly confused when it sees one of them.
1 parent 215fba7 commit c972c92

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
module.exports = function(content) {
66
this.cacheable && this.cacheable();
77
this.value = content;
8-
return "export default " + JSON.stringify(content);
8+
content = JSON.stringify(content)
9+
.replace(/\u2028/g, '\\u2028')
10+
.replace(/\u2029/g, '\\u2029');
11+
return "export default " + content;
912
}

0 commit comments

Comments
 (0)