-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
62 lines (57 loc) · 1.28 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
const join = require('path').join;
const resolve = require('path').resolve;
const webpack = require('webpack');
const OpenBrowserPlugin = require('open-browser-webpack-plugin');
const PATHS = {
src: join(__dirname, 'src'),
fonts: join(__dirname, 'fonts'),
build: join(__dirname, 'build')
};
module.exports = {
entry: {
src: join(PATHS.src, 'index.js')
},
resolve: {
extensions: ['', '.js']
},
output: {
path: PATHS.build,
publicPath: '/build/',
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.css$/,
loaders: ['style', 'css'],
include: PATHS.src
}, {
test: /\.js$/,
loader: 'babel',
include: PATHS.src,
exclude: /node_modules/
}, {
test: /\.(eot|svg|ttf|woff|woff2)$/,
include : PATHS.fonts,
loader: `file?name=/fonts/[name].[ext]`
}]
},
devtool: 'eval-source-map',
devServer: {
contentBase: process.cwd(),
historyApiFallback: true,
hot: true,
inline: true,
progress: true,
// display only errors to reduce the amount of output
stats: 'errors-only',
// parse host and port from env so this is easy
// to customize
host: process.env.HOST,
port: process.env.PORT
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new OpenBrowserPlugin({
url: 'http://localhost:8080/webpack-dev-server/bundle'}),
]
};