-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
85 lines (84 loc) · 1.88 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
var path = require('path')
var { resolve } = path
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var OpenBrowserPlugin = require('open-browser-webpack-plugin')
var autoprefixer = require('autoprefixer');
module.exports = {
entry: resolve(__dirname, 'app/index.jsx'),
output: {
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.json', '.jsx']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.less$/,
loader: 'style-loader!css-loader!postcss-loader!less-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: [
autoprefixer(),
]
}
}
],
exclude: /node_modules/
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: __dirname + '/app/index.tmpl.html'
}),
new webpack.HotModuleReplacementPlugin(),
new OpenBrowserPlugin({
url: 'http://localhost:8089'
}),
new webpack.DefinePlugin({
_DEV: process.env.NODE_ENV === 'dev'
})
],
devServer: {
inline: true,
hot: true,
historyApiFallback: true,
host: '0.0.0.0', // can be overwritten by process.env.HOST
port: 8089,
}
}