-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
55 lines (49 loc) · 1.29 KB
/
webpack.config.dev.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
const path = require('path');
const webpack = require('webpack');
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: [
// entry to react
path.resolve(__dirname, 'src/index.js')
],
output: {
// Add /* filename */ comments to generated require()s in the output.
pathinfo: true,
// where to build the package
path: path.join(__dirname, 'public'),
filename: 'bundle.js',
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: info =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [{
test: /\.js$/,
use: [ 'source-map-loader' ],
include: path.resolve(__dirname, 'src'),
enforce: 'pre',
},{
test: /\.(js|jsx)$/,
use: "babel-loader",
include: path.resolve(__dirname, 'src'),
exclude: /node_modules/
}, {
test: /\.css$/,
use: ["style-loader", "css-loader"]
}
]
},
devServer: {
host: '0.0.0.0',
port: process.env.PORT || 3000,
// where to get the index.html from
contentBase: path.resolve(__dirname, 'public'),
watchOptions: {
poll: 500
}
},
};