Cleanup localeFlags.ts [skip ci]

This commit is contained in:
ErickSkrauch
2020-07-20 15:19:15 +03:00
parent c1a790f48b
commit 347fd59319
5 changed files with 34 additions and 40 deletions

View File

@@ -17,7 +17,7 @@ const EagerImportsPlugin = require('eager-imports-webpack-plugin').default;
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const config = require('./config');
const SUPPORTED_LANGUAGES = Object.keys(require('app/i18n').default);
const localeFlags = require('app/components/i18n/localeFlags').default;
const { getCountriesList } = require('app/components/i18n/localeFlags');
const rootPath = path.resolve('./packages');
const outputPath = path.join(__dirname, 'build');
@@ -112,12 +112,12 @@ const webpackConfig = {
// @see components/i18n/localeFlags.js
new webpack.ContextReplacementPlugin(
/flag-icon-css\/flags\/4x3/,
new RegExp(`/(${localeFlags.getCountryList().join('|')})\\.svg`),
new RegExp(`/(${getCountriesList().join('|')})\\.svg`),
),
// @see components/i18n/localeFlags.js
new webpack.ContextReplacementPlugin(
/app\/components\/i18n\/flags/,
new RegExp(`/(${localeFlags.getCountryList().join('|')})\\.svg`),
new RegExp(`/(${getCountriesList().join('|')})\\.svg`),
),
],