-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
69 lines (67 loc) · 1.9 KB
/
webpack.dev.config.js
File metadata and controls
69 lines (67 loc) · 1.9 KB
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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const autoprefixer = require('autoprefixer');
const devConfig = {
entry: [
'babel-polyfill',
'./src/app/app.js',
'webpack/hot/dev-server',
'webpack-hot-middleware/client'
],
output: {
publicPath: `${process.env.HOST || 'http://localhost:4000' }/`,
path: '/',
filename: 'js/app.js'
},
mode: 'development',
devtool: 'source-map',
resolve: {
extensions: ['.js']
},
module: {
rules: [
{
test: /\.js?$/,
enforce: 'pre',
use: ['eslint-loader'],
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader',
`postcss-loader?${ JSON.stringify(
[ autoprefixer({ browsers: ['last 3 versions'] }) ]
)}`]
},
{
test: /\.js?$/,
exclude: /(node_modules|bower_components)/,
use: ['babel-loader']
},
{
test: /\.(eot|ttf|woff|woff2|otf)$/,
use: 'url-loader'
},
{
test: /\.(png|jpg|jpeg|gif|woff|svg)$/,
use: 'file-loader'
}
]
},
plugins: [
// inject styles and javascript into index.html
new HtmlWebpackPlugin({
title: 'Webpack Build',
template: './src/app/index.html'
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
performance: {
hints: process.env.NODE_ENV === 'production' ? 'warning' : false
},
};
module.exports = devConfig;