json-perf-loader
Advanced tools
Comparing version
{ | ||
"name": "json-perf-loader", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A loader for webpack to load JSON with performance advice", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -16,6 +16,5 @@ const { getOptions } = require('loader-utils') | ||
console.log(source) | ||
let value | ||
try { | ||
@@ -26,14 +25,14 @@ value = typeof source === 'string' ? JSON.parse(source) : source | ||
} | ||
if (shouldInline(options.limit, source.length)) { | ||
value = JSON.stringify(value) | ||
.replace(/\u2028/g, '\\u2028') | ||
.replace(/\u2029/g, '\\u2029') | ||
.replace(/\u2028/g, '\\u2028') | ||
.replace(/\u2029/g, '\\u2029') | ||
return `module.exports = ${value}` | ||
} | ||
return `module.exports = JSON.parse('${source}')` | ||
return `module.exports = JSON.parse('${JSON.stringify(value)}')` | ||
} | ||
exports.raw = true; |
5963
0.02%33
-2.94%