-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
37 lines (35 loc) · 946 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
const path = require('path');
const webpack = require('webpack');
const IS_DEV = process.env.NODE_ENV !== 'production';
const SRC_DIR = path.join(__dirname, './src');
const DIST_DIR = path.join(__dirname, './dist');
module.exports = {
entry: path.join(SRC_DIR, 'client'),
module: {
rules: [{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}]
},
output: {
path: DIST_DIR,
filename: IS_DEV ? '[name].js' : '[name].[hash].js',
publicPath: '/'
},
resolve: {
modules: ['src', 'node_modules'],
extensions: ['*', '.js', '.jsx', '.json']
},
devServer: {
contentBase: DIST_DIR,
port: 9000,
historyApiFallback: true,
publicPath: '/'
},
plugins: [
IS_DEV && new webpack.HotModuleReplacementPlugin()
].filter(Boolean)
};