-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
94 lines (93 loc) · 2.17 KB
/
webpack.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
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
const path = require('path');
const webpack = require('webpack');
const buildPath = path.resolve(__dirname, 'public');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
/* 'babel-polyfill', */
'react-hot-loader/patch',
'webpack-dev-server/client?http://0.0.0.0:3000/',
'webpack/hot/only-dev-server',
'./src/index'
],
output: {
path: buildPath, //Path where the bundle should be exported
filename: 'js/bundle.js', //Filename
publicPath: '/' //Where the js gets loaded from
},
mode: 'development',
devtool: 'source-map',
module: {
rules: [
{
test: /\.jsx?$/,
use: {
loader: 'babel-loader'
},
include: path.join(__dirname, 'src'),
exclude: /(node_modules|bower_components)/
},
{
test: /\.(png|jpg|jpeg|svg)$/,
include: path.join(__dirname, 'public/img'),
use: [
{
loader: 'url-loader'
}
]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
include: path.join(__dirname, 'public/fonts'),
use: [
{
loader: 'url-loader'
}
]
},
{
test: /\.less$/,
use: [
{
loader: 'style-loader',
options: {
sourceMap: true,
convertToAbsoluteUrls: true
}
},
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'less-loader',
options: {
sourceMap: true
}
}
]
}
]
},
resolve: {
modules: [path.join(__dirname, 'src'), 'node_modules']
},
plugins: [
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/Template/template.html',
inject: 'body',
hash: true,
cache: true,
showErrors: true
})
]
};