-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathwebpack.config.js
50 lines (49 loc) · 1.27 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
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const webpack = require("webpack");
const pkg = require("./package.json");
const VERSION = pkg.version;
const srcBanner = `LeetCodeRating ${VERSION}
index.min.css
Copyright (C) 2024 zhang-wangzReact and all contributors
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.`;
module.exports = {
entry: './index.js',
output: {
filename: 'index.js',
},
module: {
rules: [
{ test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$/, loader: "file-loader" },
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader"
],
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "index.min.css"
}),
new webpack.BannerPlugin(srcBanner),
new CopyPlugin({
patterns: [
{ from: "LICENSE" },
{ from: "package.json" },
],
}),
new CleanWebpackPlugin(),
],
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 8000
}
};