-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
73 lines (72 loc) · 1.8 KB
/
webpack.dev.js
File metadata and controls
73 lines (72 loc) · 1.8 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
70
71
72
73
const path = require('path');
const webpack = require('webpack');
const buildPath = path.resolve(__dirname, 'public');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000/',
'webpack/hot/only-dev-server',
'react-hot-loader/patch',
'./src/index'
],
output: {
sourceMapFileName: 'js/bundle.js.map', //Filename
path: buildPath, //Path where the bundle should be exported
filename: 'js/bundle.js', //Filename
publicPath: '/' //Where the js gets loaded from
},
//devtool: 'source-map',
devtool: 'eval-source-map',
cache: false,
module: {
preLoaders: [
{
test: /\.json$/,
exclude: /(node_modules)/,
loader: 'json'
}
],
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel-loader'],
include: path.join(__dirname, 'src'),
exclude: /(node_modules|bower_components)/
},
{
test: /\.less$/,
loaders: [
'style-loader',
'css-loader',
'less-loader',
'postcss-loader'
],
include: path.join(__dirname, 'src', 'Less')
},
{
test: /\.(png|jpg|jpeg|svg|woff|woff2|eot|ttf|otf)$/,
loader: 'url-loader'
}
]
},
resolve: {
root: path.resolve('./src'),
extenstions: ['', '.js']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
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: false
})
]
};