generated from yandex-praktikum/middle.messenger.praktikum.yandex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.ts
67 lines (64 loc) · 1.54 KB
/
webpack.common.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import HtmlWebpackPlugin from "html-webpack-plugin";
import path from "path";
import webpack from "webpack";
const srcDir = path.resolve(__dirname, "src");
const config: webpack.Configuration = {
context: path.resolve(__dirname, "src"),
entry: {
app: "./index.ts",
},
output: {
path: path.resolve(__dirname, "dist"),
publicPath: "/",
clean: true,
},
watchOptions: {
ignored: /node_modules/,
},
resolve: {
extensions: [".ts", ".js"],
alias: {
handlebars: "handlebars/dist/handlebars.js",
app: path.resolve(srcDir, "app"),
processes: path.resolve(srcDir, "processes"),
pages: path.resolve(srcDir, "pages"),
widgets: path.resolve(srcDir, "widgets"),
features: path.resolve(srcDir, "features"),
entities: path.resolve(srcDir, "entities"),
shared: path.resolve(srcDir, "shared"),
},
},
module: {
rules: [
{
test: /\.(js|ts)$/,
exclude: /node_modules/,
use: "babel-loader",
},
{
test: /\.hbs/,
type: "asset/source",
},
{
test: /\.(?:ico|gif|png|jpg|jpeg|svg)$/i,
type: "asset/resource",
generator: {
filename: "img/[name]-[contenthash][ext]",
},
},
{
test: /\.(woff(2)?|eot|ttf|otf|)$/,
type: "asset/resource",
generator: {
filename: "fonts/[name]-[contenthash][ext]",
},
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: "./index.html",
}),
],
};
export default config;