We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b81a25f commit cdb1927Copy full SHA for cdb1927
lib/index.js
@@ -0,0 +1,23 @@
1
+'use strict';
2
+
3
+Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+});
6
7
+exports.default = function (content) {
8
+ if (this.version && this.version >= 2) {
9
+ try {
10
+ var value = typeof content === 'string' ? JSON.parse(content) : content;
11
+ value = JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
12
+ var code = 'module.exports = function (Component) { Component.options.__i18n = \'' + value + '\' }';
13
+ this.callback(null, code);
14
+ } catch (err) {
15
+ this.emitError(err.message);
16
+ this.callback(err);
17
+ }
18
+ } else {
19
+ var message = 'support webpack 2 later';
20
+ this.emitError(message);
21
+ this.callback(new Error(message));
22
23
+};
0 commit comments