-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathwebpack.config.cjs
42 lines (40 loc) · 1.16 KB
/
webpack.config.cjs
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
const webpack = require("webpack");
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const AssetsPlugin = require("assets-webpack-plugin");
const OUTPUT_DIR = path.resolve(__dirname, "server/public");
module.exports = (_, { mode }) => ({
entry: "./client/client.js",
output: {
filename: "[name].[fullhash].js",
path: OUTPUT_DIR,
publicPath: "",
},
plugins: [
new MiniCssExtractPlugin({ filename: "[name].[fullhash].css" }),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
}),
new AssetsPlugin(),
],
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /\.(jpe?g|svg|png|gif|ico|eot|ttf|woff2|map?)(\?v=\d+\.\d+\.\d+)?$/i,
type: 'asset/resource',
},
{
test: /\.svg$/,
loader: "file-loader",
options: {
name: "[name].[ext]",
},
},
],
},
});