generated from yandex-praktikum/middle.messenger.praktikum.yandex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.ts
48 lines (45 loc) · 1 KB
/
webpack.prod.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
45
46
47
48
import Dotenv from "dotenv-webpack";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
import TerserPlugin from "terser-webpack-plugin";
import webpack from "webpack";
import { merge } from "webpack-merge";
import common from "./webpack.common";
const config: webpack.Configuration = merge(common, {
mode: "production",
devtool: false,
output: {
filename: "[name]-[contenthash:8].js",
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
keep_fnames: true,
},
mangle: {
keep_fnames: true,
},
},
}),
],
},
module: {
rules: [
{
test: /\.s[ca]ss$/i,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
},
],
},
plugins: [
new Dotenv({
path: ".env.production",
}),
new MiniCssExtractPlugin({
filename: "[name].css?id=[contenthash]",
}),
],
});
export default config;