-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
62 lines (60 loc) · 2.11 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import path from "path";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
import { Configuration as WebpackConfiguration } from "webpack";
import { Configuration as WebpackDevServerConfiguration } from "webpack-dev-server";
interface Configuration extends WebpackConfiguration {
devServer?: WebpackDevServerConfiguration;
}
export default function(): Configuration {
return {
entry: "./src/index.tsx",
module: {
rules: [
{
test : /\.tsx?$/,
use : "ts-loader",
exclude : /node_modules/,
}, {
test : /\.html$/,
type : "asset/resource",
generator : {
filename: "[name][ext]",
}
}, {
test : /\.(png|svg|woff2)$/,
type : "asset/resource",
generator : {
filename: "assets/[name][ext]",
}
}, {
test : /favicon\.png$/,
type : "asset/resource",
generator : {
filename: "[name][ext]",
}
}, {
test : /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
}
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
plugins: [new TsconfigPathsPlugin({ configFile: "./tsconfig.json" })]
},
output: {
filename : "main.js",
path : path.resolve(__dirname, "dist")
},
plugins: [new MiniCssExtractPlugin()],
devServer: {
static: {
publicPath: path.resolve(__dirname, "dist"),
},
allowedHosts : "all",
compress : false,
port : 3000,
}
}
};