-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
61 lines (60 loc) · 1.36 KB
/
webpack.common.js
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
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
module.exports = {
entry: {
app: "./src/app.ts",
},
plugins: [
new CleanWebpackPlugin(), //clean un-used files in /dist
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({
//create a new index.html
title: "M2-CAST",
favicon: "./src/redux/assets/img/logo.ico",
}),
],
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist"),
},
module: {
rules: [
// {
// test: /\.js$/,
// use: ["source-map-loader"],
// enforce: "pre"
// },
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
{
test: /\.(png|svg|jpg|gif)$/,
type: "asset/resource",
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"resolve-url-loader",
"sass-loader",
],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
type: "asset/resource",
},
{
test: /\.(csv|tsv)$/,
use: ["csv-loader"],
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
};