Skip to content

Commit

Permalink
add a new package for webpack to copy locales on build production
Browse files Browse the repository at this point in the history
  • Loading branch information
stasguma committed Apr 26, 2024
1 parent 3db77ca commit a8d1823
Show file tree
Hide file tree
Showing 3 changed files with 9,757 additions and 8,073 deletions.
12 changes: 12 additions & 0 deletions config/build/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import Dotenv from 'dotenv-webpack';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
Expand Down Expand Up @@ -27,6 +28,17 @@ export const plugins = function (
new Dotenv(),
];

if (!isDev) {
plugins.push(
/* eslint-disable-next-line */
new CopyPlugin({
patterns: [
{ from: 'public/locales', to: 'locales' },
],
})
);
}

if (isDev) {
plugins.push(new BundleAnalyzerPlugin({
openAnalyzer: false,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@types/webpack-bundle-analyzer": "^4.6.3",
"babel-loader": "^9.1.3",
"chromatic": "^10.7.1",
"copy-webpack-plugin": "^12.0.2",
"cross-env": "^7.0.3",
"css-loader": "^6.9.0",
"css-minimizer-webpack-plugin": "^5.0.1",
Expand Down
Loading

0 comments on commit a8d1823

Please sign in to comment.