-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
91 lines (90 loc) · 2.22 KB
/
webpack.config.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const path = require("path");
const webpack = require("webpack");
const HtmlWebPackPlugin = require("html-webpack-plugin");
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
module.exports = {
entry: {
index: [
"@fortawesome/fontawesome-free/js/all.js",
"aos/dist/aos.css",
"./src/assets/css/index.css",
"./src/assets/js/index.js",
"./src/assets/lottie/lf20_ynle8i40.json",
"./src/assets/lottie/lf20_yYOpBn.json",
],
querator: [
"@fortawesome/fontawesome-free/js/all.js",
"./src/assets/css/querator.css",
],
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
assetModuleFilename: "images/[hash][ext][query]",
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "index.html",
chunks: ["index"],
}),
new HtmlWebPackPlugin({
template: "./src/querator.html",
filename: "querator.html",
chunks: ["querator"],
}),
new FaviconsWebpackPlugin("src/favicon.png"),
new MiniCssExtractPlugin({
filename: "[name].bundle.css",
chunkFilename: "[id].css",
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
}),
new CleanWebpackPlugin(),
],
module: {
rules: [
{
test: /\.(html)$/,
use: ["html-loader"],
},
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: MiniCssExtractPlugin.loader,
options: { esModule: false },
},
{
loader: "css-loader",
options: { importLoaders: 1 },
},
"postcss-loader",
],
},
{
test: /\.(png|jpe?g|svg|gif)$/i,
type: "asset/resource",
},
{
test: /\.m?js$/i,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
],
},
devServer: {
static: path.resolve(__dirname, "dist"),
open: true,
},
};