Web.Client: added webpack config for moving translation resources

This commit is contained in:
Daniil Senkiv 2019-09-03 13:35:33 +03:00
parent 5f878e4537
commit eea51947d3

View File

@ -0,0 +1,23 @@
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = (config) => {
config.plugins.push(
new CopyWebpackPlugin(
[
{
from: path.join('src', path.sep, 'components', path.sep, '**', path.sep, 'locales', path.sep, '**'),
to: 'locales',
transformPath(targetPath) {
const reversedArrayOfFolders = path.dirname(targetPath).split(path.sep).reverse();
const localePath = reversedArrayOfFolders.pop();
const finalPath = path.join(path.sep, localePath, path.sep, reversedArrayOfFolders[2], path.sep, reversedArrayOfFolders[0], path.sep, path.basename(targetPath));
return finalPath;
},
}
]
)
);
return config;
}