-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.server.js
35 lines (35 loc) · 1009 Bytes
/
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
const path = require('path')
const nodeExternals = require('webpack-node-externals') // 排除node模块
// 服务端的webpack
module.exports = {
target: "node",
mode: "development",
entry: './server/index.js',
externals: [nodeExternals()],
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'build')
},
module: {
rules: [
{
test: /\.js$/,
// 才能支持import,支持jsx
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ['@babel/preset-react', '@babel/preset-env']
}
},
{
test: /\.css$/,
use: ['isomorphic-style-loader', {
loader: 'css-loader',
options: {
modules: true // 开启css module的支持
}
}]
}
]
}
}