Skip to content

Commit

Permalink
feat: export as json instead of object literal (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
intrnl authored and ScriptedAlchemy committed Nov 25, 2019
1 parent bea9514 commit 567f74e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 567f74e

Please sign in to comment.