From d4286152812617065079e6342c1ff012c6b89329 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Tue, 7 Mar 2017 00:26:02 -0700 Subject: [PATCH] fix webpack/browserify --- browserify-transform.js | 6 ++++-- webpack-loader.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/browserify-transform.js b/browserify-transform.js index 21e56bf..6fe6243 100644 --- a/browserify-transform.js +++ b/browserify-transform.js @@ -1,6 +1,8 @@ var through = require("through2"); -var I18nliner = require("i18nliner"); +var I18nliner = require("i18nliner").default; var config = I18nliner.config; +var JsProcessor = require('i18nliner/dist/lib/processors/js_processor').default +var parse = JsProcessor.prototype.parse; var preprocess = require("./preprocess"); var hasTranslatableText = require("./hasTranslatableText")(config); @@ -8,7 +10,7 @@ module.exports = function() { return through(function (buf, enc, next) { var source = buf.toString('utf8'); if (hasTranslatableText(source)) - source = preprocess(source, config); + source = preprocess(parse(source), config); this.push(source); next(); }); diff --git a/webpack-loader.js b/webpack-loader.js index db90e58..115e2d6 100644 --- a/webpack-loader.js +++ b/webpack-loader.js @@ -1,5 +1,7 @@ -var I18nliner = require("i18nliner"); +var I18nliner = require("i18nliner").default; var config = I18nliner.config; +var JsProcessor = require('i18nliner/dist/lib/processors/js_processor').default; +var parse = JsProcessor.prototype.parse; var preprocess = require("./preprocess"); var hasTranslatableText = require("./hasTranslatableText")(config); @@ -27,6 +29,6 @@ module.exports = function(source) { this.cacheable(); addNoParse.call(this); if (hasTranslatableText(source)) - source = preprocess(source, config); + source = preprocess(parse(source), config); return source; };