Skip to content

Commit

Permalink
⭐ new: added hmr (#14, closes #7) by @StephanGerbeth
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanGerbeth authored and kazupon committed Mar 4, 2018
1 parent 82a0f86 commit c04964c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ function generateCode(content) {
var value = typeof content === 'string' ? JSON.parse(content) : content;
value = JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029').replace(/\\/g, '\\\\');

code += 'function (Component) {\n Component.options.__i18n = Component.options.__i18n || []\n Component.options.__i18n.push(\'' + value.replace(/\u0027/g, '\\u0027') + '\')\n}\n';
code += 'function (Component) {\n Component.options.__i18n = Component.options.__i18n || []\n Component.options.__i18n.push(\'' + value.replace(/\u0027/g, '\\u0027') + '\')\n delete Component.options._Ctor\n}\n';
return code;
}
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function generateCode (content) {
code += `function (Component) {
Component.options.__i18n = Component.options.__i18n || []
Component.options.__i18n.push('${value.replace(/\u0027/g, '\\u0027')}')
delete Component.options._Ctor
}\n`
return code
}

0 comments on commit c04964c

Please sign in to comment.