-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
44 lines (40 loc) · 1.15 KB
/
webpack.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as path from 'path';
import * as glob from 'glob';
import * as webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import StatoscopePlugin from '@statoscope/webpack-plugin';
// @todo загрузить переводы из файла
const config: webpack.Configuration = {
mode: 'production',
entry: glob.sync('./src/pages/**.tsx').reduce<Record<string, string>>(function(obj, el){
obj[path.parse(el).name] = el;
return obj
},{}),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].js',
clean: true,
},
plugins: [
new HtmlWebpackPlugin(),
new StatoscopePlugin({
saveStatsTo: 'stats.json',
saveOnlyStats: false,
open: false,
}),
],
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
module: {
rules: [
{ test: /\.([cm]?ts|tsx)$/, use: [ "ts-loader", 'i18n-loader'] }
]
},
resolveLoader: {
alias: {
'i18n-loader': path.resolve(__dirname, 'loaders/i18n-loader.cjs'),
},
},
};
export default config;