UNPKG

706 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7exports.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};
\No newline at end of file