[DURACOM-191] align with main branch and migrated to be standalone new components

This commit is contained in:
Vlad Nouski
2023-12-11 11:08:22 +01:00
parent 8a7b459695
commit 1f15b21ba9
245 changed files with 10480 additions and 3191 deletions

View File

@@ -1,4 +1,5 @@
import { globalCSSImports, projectRoot } from './helpers';
import { globalCSSImports, projectRoot, getFileHashes, calculateFileHash } from './helpers';
import { EnvironmentPlugin } from 'webpack';
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
@@ -18,12 +19,13 @@ export const copyWebpackOptions = {
// use [\/|\\] to match both POSIX and Windows separators
const matches = absoluteFilename.match(/.*[\/|\\]assets[\/|\\](.+)\.json5$/);
if (matches) {
const fileHash: string = process.env.NODE_ENV === 'production' ? `.${calculateFileHash(absoluteFilename)}` : '';
// matches[1] is the relative path from src/assets to the JSON5 file, without the extension
return path.join('assets', matches[1] + '.json');
return path.join('assets', `${matches[1]}${fileHash}.json`);
}
},
transform(content) {
return JSON.stringify(JSON5.parse(content.toString()))
return JSON.stringify(JSON5.parse(content.toString()));
}
},
{
@@ -77,6 +79,9 @@ const SCSS_LOADERS = [
export const commonExports = {
plugins: [
new EnvironmentPlugin({
languageHashes: getFileHashes(path.join(__dirname, '..', 'src', 'assets', 'i18n'), /.*\.json5/g),
}),
new CopyWebpackPlugin(copyWebpackOptions),
],
module: {