-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
97 lines (95 loc) · 2.41 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
95
96
97
const path = require('path')
const webpack = require('webpack')
module.exports = {
mode: 'development',
performance: {
hints: 'warning'
},
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 9000,
open: true
},
entry: {
index: [
path.resolve(__dirname, 'src/index'),
'webpack-hot-middleware/client?reload=true', // note that it reloads the page if hot module reloading fails.
'eventsource-polyfill' // necessary for hot reloading with IE
]
},
devtool: 'inline-source-map',
output: {
publicPath: '/',
path: path.resolve(__dirname, '/build'), // Note: Physical files are only output by the production build task `npm run build`.
filename: '[name].js'
},
target: 'web',
plugins: [
new webpack.HotModuleReplacementPlugin()
],
module: {
rules: [
{
test: /\.css/,
loader: 'style-loader!css-loader'
},
{
test: /\.scss/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader?importLoaders=1&modules',
options: {
importLoaders: 1,
modules: true
}
},
{
loader: 'sass-loader'
}
]
},
{
test: /.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015', 'react', 'env'],
plugins: ['transform-class-properties', 'transform-object-rest-spread']
}
}
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
use: 'url-loader?limit=10000&mimetype=application/octet-stream'
},
{
test: /\.otf(\?v=\d+\.\d+\.\d+)?$/,
use: 'url-loader?limit=10000&mimetype=application/octet-stream'
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
use: 'url-loader?limit=10000&mimetype=application/octet-stream'
},
{
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
use: 'url-loader?limit=10000&mimetype=application/octet-stream'
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
use: 'url-loader?limit=10000&mimetype=application/octet-stream'
},
{
test: /\.(png|jpg|ico|svg|gif)$/,
loader: 'url-loader?limit=1000000'
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.es6']
}
}