From b181142d5bb174f875cf558c81bc64dc3d16e9b9 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Tue, 1 Aug 2017 20:31:47 +0300 Subject: [PATCH] Fix intl-loader, that was broken after json-loader update --- webpack-utils/intl-loader.js | 6 +++--- webpack.config.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webpack-utils/intl-loader.js b/webpack-utils/intl-loader.js index a6c1a59..83c01e4 100644 --- a/webpack-utils/intl-loader.js +++ b/webpack-utils/intl-loader.js @@ -1,12 +1,12 @@ -module.exports = function() { +module.exports = function(content) { this.cacheable && this.cacheable(); + content = JSON.parse(content); - var moduleId = this.context + const moduleId = this.context .replace(this.options.resolve.root, '') .replace(/^\/|\/$/g, '') .replace(/\//g, '.'); - var content = this.inputValue[0]; content = JSON.stringify(Object.keys(content).reduce(function(translations, key) { translations[key] = { id: moduleId + '.' + key, diff --git a/webpack.config.js b/webpack.config.js index 0bab132..4e6feb4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -178,7 +178,7 @@ const webpackConfig = { }, { test: /\.intl\.json$/, - loader: 'babel!intl!json' + loader: 'babel!intl' }, { test: /\.font\.(js|json)$/,