From 939a8cb00fd72ad5e34c00a529bf1e5c49560a89 Mon Sep 17 00:00:00 2001 From: Andrew Hyndman Date: Sat, 18 Mar 2017 09:26:30 +1100 Subject: [PATCH] fix: escape newline/paragraph separators (#18) --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 5cadd7d..76b50dd 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,8 @@ module.exports = function(source) { var value = typeof source === "string" ? JSON.parse(source) : source; var options = loaderUtils.getOptions(this) || {}; value = JSON.stringify(value) + .replace(/\u2028/g, '\\u2028') + .replace(/\u2029/g, '\\u2029'); value = options.stringify ? `'${value}'` : value var module = this.version && this.version >= 2 ? `export default ${value};` : `module.exports = ${value};`; return module