-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.server.js
76 lines (66 loc) · 1.39 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const path = require('path');
const externals = require('webpack-node-externals');
module.exports = {
mode: 'production',
target: 'node',
externals: [externals()],
entry: './src/server/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'build'),
publicPath: '/',
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
modules: [
path.join(__dirname, 'src'),
path.join(__dirname, 'node_modules'),
],
},
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/,
use: [
{
loader: 'css-loader',
options: {
localsConvention: 'camelCase',
modules: {
localIdentName: '[name]-[local]-[hash:8]',
},
},
},
],
},
{
test: /\.s[ac]ss$/,
use: [
'css-loader',
'resolve-url-loader',
'sass-loader',
],
},
{
exclude: [
/\.html$/,
/\.jsx?$/,
/\.tsx?$/,
/\.css$/,
/\.s[ac]ss$/,
/\.json$/,
],
loader: 'file-loader',
options: {
name: 'static/media/[name].[hash:8].[ext]',
emitFile: false,
},
},
],
},
};