-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.ts
40 lines (34 loc) · 885 Bytes
/
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
import path from "path";
import HtmlWebpackPlugin from "html-webpack-plugin";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
import type { Configuration } from "webpack";
const commonConfig: Configuration = {
entry: path.resolve(__dirname, "src/index.tsx"),
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"],
plugins: [new TsconfigPathsPlugin()],
},
module: {
rules: [
{
test: /\.(mjs|js|ts|tsx)$/,
exclude: /(node_modules)/,
use: { loader: "swc-loader" },
},
{
test: /\.svg?$/,
use: { loader: "raw-loader" },
},
],
},
plugins: [
new HtmlWebpackPlugin({
cache: true,
filename: "index.html",
title: "hello universe",
template: path.resolve(__dirname, "src/index.html"),
publicPath: "/",
}),
],
};
export default commonConfig;