From 567f74e59b6da8ab8c099c0a7d1953c4c9c88227 Mon Sep 17 00:00:00 2001 From: intrnl Date: Mon, 25 Nov 2019 11:58:08 +0700 Subject: [PATCH] feat: export as json instead of object literal (#186) --- src/loader.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/loader.js b/src/loader.js index d72cbc52..505aa91c 100644 --- a/src/loader.js +++ b/src/loader.js @@ -182,8 +182,11 @@ export function pitch(request) { } let resultSource = `// extracted by ${pluginName}`; + const json = JSON.stringify(locals); + const stringified = JSON.stringify(json); + const result = locals - ? `\nmodule.exports = ${JSON.stringify(locals)};` + ? `\nmodule.exports = JSON.parse(${stringified});` : ''; resultSource += options.hot