-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.client.js
49 lines (48 loc) · 1.39 KB
/
webpack.client.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
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
/** @type {import('webpack').Configuration} */
module.exports = {
mode: "development",
entry: path.resolve(__dirname, "src/index.js"),
resolve: {
extensions: [".ts", ".js", ".tsx", ".jsx"],
},
output: {
path: path.resolve(__dirname, "dist/client"),
},
module: {
rules: [
{
test: /\.(css|scss)$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }]],
},
},
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: "public/index.html",
}),
new CopyWebpackPlugin({
patterns: [
{ from: "public/image", to: "image" },
{ from: "public/nav-icon", to: "nav-icon" },
{ from: "public/background-music.mp3", to: "background-music.mp3" },
{ from: "public/favicon.ico", to: "public/favicon.ico" },
{ from: "public/logo192.png", to: "public/logo192.png" },
{ from: "public/logo512.png", to: "public/logo512.png" },
{ from: "public/manifest.json", to: "public/manifest.json" },
],
}),
],
};