From 48bef95a4d3655e93186a77ba9305be02f1ce026 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 24 May 2017 00:26:55 +0700 Subject: [PATCH] Simplify yaml loading --- client/coral-framework/services/i18n.js | 4 ++-- webpack.config.js | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/client/coral-framework/services/i18n.js b/client/coral-framework/services/i18n.js index e479a9e10..c8b9a0c4f 100644 --- a/client/coral-framework/services/i18n.js +++ b/client/coral-framework/services/i18n.js @@ -9,8 +9,8 @@ const esTA = require('../../../node_modules/timeago.js/locales/es'); const defaultLanguage = 'en'; const locales = Object.assign( - require('json-loader!yaml-loader!../locales/en.yml'), - require('json-loader!yaml-loader!../locales/es.yml') + require('../locales/en.yml'), + require('../locales/es.yml') ); let translations = {}; diff --git a/webpack.config.js b/webpack.config.js index b3f8295c4..ddd2f9577 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -24,8 +24,6 @@ if (process.env.TALK_PLUGINS_JSON && process.env.TALK_PLUGINS_JSON.length > 0) { pluginsConfigPath = defaultPlugins; } -let localesPath = path.join(__dirname, 'locales'); - console.log(`Using ${pluginsConfigPath} as the plugin configuration path`); // Edit the build targets and embeds below. @@ -91,9 +89,14 @@ const config = { }, { loader: 'json-loader', - test: /\.json$/, + test: /\.(json|yml)$/, exclude: /node_modules/ }, + { + loader: 'yaml-loader', + exclude: /node_modules/, + test: /\.yml$/, + }, { loaders: [ 'style-loader', @@ -118,11 +121,6 @@ const config = { test: /\.(graphql|gql)$/, exclude: /node_modules/, loader: 'graphql-tag/loader' - }, - { - loader: 'yaml', - include: localesPath, - test: /\.yml$/, } ] },