-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
101 lines (90 loc) · 2.18 KB
/
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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
let webpack = require('webpack');
let path = require('path');
let SERVER_PORT = 7000;
let DEV_PORT = SERVER_PORT + 1;
module.exports = {
entry: [
// WebpackDevServer host and port
`webpack-dev-server/client?http://localhost:${DEV_PORT}`,
'webpack/hot/only-dev-server',
// Your appʼs entry point
'./app/main'
],
devtool: 'inline-source-map',
debug: true,
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
modulesDirectories: ['web_modules', 'node_modules'],
extensions: ['', '.web.js', '.js', '.jsx'],
alias: {}
},
module: {
noParse: [],
loaders: [
{
test: /\.js$/,
loader: 'react-hot!babel!eslint',
exclude: /node_modules/,
include: [
path.resolve(__dirname, './app'),
path.resolve(__dirname, './components')
]
},
{
test: /\.css$/,
loader: 'style!css!autoprefixer'
},
{
test: /\.less$/,
loader: 'style!css!autoprefixer!less'
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file?limit=10000'
},
{
test: /\.jpe?g$|\.gif$|\.png$/,
loader: 'file?limit=100000'
},
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file?limit=10000'
}
]
},
output: {
path: path.resolve(__dirname, './build'),
filename: 'app.bundle.js',
},
externals: {
'sweetalert': 'swal'
},
port: DEV_PORT,
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
__CLIENT__: true,
__SERVER__: false,
__DEV__: true,
__DEVTOOLS__: true
}
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
devServer: {
contentBase: './build',
stats: {
cached: false,
colors: true,
exclude: [
/node_modules[\\\/]react(-router)?[\\\/]/
]
},
// enables the HotModuleReplacementPlugin.
hot: true,
// Set this as true if you want to access dev server from arbitrary url.
// This is handy if you are using a html5 router.
historyApiFallback: true,
},
};