-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
48 lines (46 loc) · 992 Bytes
/
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
const webpack = require("webpack");
const serverConfig = {
entry: "./server.js",
target: "node",
output: {
path: __dirname,
filename: "server.js",
libraryTarget: "commonjs2",
},
devtool: "cheap-module-source-map",
module: {
rules: [
{
test: [/\.svg$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: "file-loader",
options: {
name: "public/media/[name].[ext]",
publicPath: (url) => url.replace(/public/, ""),
emit: false,
},
},
{
test: /\.css$/,
use: [
{
loader: "css-loader/locals",
},
],
},
{
test: /js$/,
exclude: /(node_modules)/,
loader: "babel-loader",
query: { presets: ["react-app"] },
},
],
},
plugins: [
new webpack.BannerPlugin({
banner: "__isBrowser__ = false;",
raw: true,
include: /\.js$/,
}),
],
};
module.exports = [serverConfig];