-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.server.js
58 lines (57 loc) · 1.31 KB
/
webpack.server.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
const path = require('path');
const webpackNodeExternals = require('webpack-node-externals');
module.exports = {
target: 'node',
entry: './src/server/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'build-server'),
},
externals: [webpackNodeExternals()], // excludes node modules in Webpack
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
},
// we use url-loader as loader for webpack which transforms files into base64 URIs
{
test: /\.(gif|jpe?g|png|ico)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
},
},
],
},
{
test: /\.(otf|eot|svg|ttf|woff|woff2).*$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
},
},
],
},
// we use css-loader for handling css files
{
test: /\.css$/i,
use: ['css-loader'],
},
],
},
optimization: {
nodeEnv: 'development', // NODE_ENV
},
};