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

Commit 8f9816e

Browse files
committed
fix: escape newline/paragraph separators
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 8f9816e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.js

Lines changed: 4 additions & 1 deletion
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)