Skip to content

Commit c04964c

Browse files
StephanGerbethkazupon
authored andcommitted
⭐ new: added hmr (#14, closes #7) by @StephanGerbeth
1 parent 82a0f86 commit c04964c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ function generateCode(content) {
2626
var value = typeof content === 'string' ? JSON.parse(content) : content;
2727
value = JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029').replace(/\\/g, '\\\\');
2828

29-
code += 'function (Component) {\n Component.options.__i18n = Component.options.__i18n || []\n Component.options.__i18n.push(\'' + value.replace(/\u0027/g, '\\u0027') + '\')\n}\n';
29+
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';
3030
return code;
3131
}

src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function generateCode (content) {
2828
code += `function (Component) {
2929
Component.options.__i18n = Component.options.__i18n || []
3030
Component.options.__i18n.push('${value.replace(/\u0027/g, '\\u0027')}')
31+
delete Component.options._Ctor
3132
}\n`
3233
return code
3334
}

0 commit comments

Comments
 (0)