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)$/,