Skip to content

Commit 1911f64

Browse files
neoprenkazupon
authored andcommitted
🐛 bug: fixed using single quotes (#1) by @neopren
1 parent 64d1393 commit 1911f64

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exports.default = function (content) {
99
try {
1010
var value = typeof content === 'string' ? JSON.parse(content) : content;
1111
value = JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
12-
var code = 'module.exports = function (Component) { Component.options.__i18n = \'' + value + '\' }';
12+
var code = 'module.exports = function (Component) { Component.options.__i18n = \'' + value.replace(/\u0027/g, '\\u0027') + '\' }';
1313
this.callback(null, code);
1414
} catch (err) {
1515
this.emitError(err.message);

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function (content) {
77
value = JSON.stringify(value)
88
.replace(/\u2028/g, '\\u2028')
99
.replace(/\u2029/g, '\\u2029')
10-
const code = `module.exports = function (Component) { Component.options.__i18n = '${value}' }`
10+
const code = `module.exports = function (Component) { Component.options.__i18n = '${value.replace(/\u0027/g, '\\u0027')}' }`
1111
this.callback(null, code)
1212
} catch (err) {
1313
this.emitError(err.message)

0 commit comments

Comments
 (0)