-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
119 lines (116 loc) · 2.46 KB
/
webpack.config.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
const path = require('path');
const webpack = require('webpack');
const htmlWebpackPlugin = require('html-webpack-plugin');
const cleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
cache: true,
entry: [
// 'webpack-hot-middleware',
'./client/index.jsx'
],
output: {
path: path.join(__dirname, './client/dist/'),
publicPath: '/client/index.js',
filename: 'bundle.js'
},
externals: {
Materialize: 'Materialize'
},
plugins: [
new cleanWebpackPlugin([ 'client/dist' ]),
new htmlWebpackPlugin({
title: 'Hello-Books',
template: 'client/index.html',
inject: 'body'
}),
new webpack.EnvironmentPlugin([ 'secretKey' ]),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Hammer: 'hammerjs/hammer'
})
],
module: {
rules: [
{
test: /.jsx?$/,
enforce: 'pre',
use: [
{
loader: 'babel-loader',
query: {
cacheDirectory: true,
presets: [ 'es2015', 'react', 'stage-1' ]
}
}
],
include: path.join(__dirname, './client'),
exclude: /node_modules/
},
{
test: /(\.s?css)$/,
loader: [ 'style-loader', 'css-loader', 'sass-loader' ]
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader'
},
{
test: /\.woff2(\?\S*)?$/,
loader: 'url-loader?limit=100000'
},
{
test: /\.woff(\?\S*)?$/,
loader: 'url-loader?limit=100000'
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=100000&mimetype=application/octet-stream'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?name=/assets/img/[name].[ext]',
{
loader: 'image-webpack-loader',
query: {
mozjpeg: {
progressive: true
},
gifsicle: {
interlaced: false
},
optipng: {
optimizationLevel: 4
},
pngquant: {
quality: '75-90',
speed: 3
}
}
}
],
exclude: /node_modules/,
include: __dirname
},
{
test: /materialize-css\/bin\//,
loader: 'imports-loader?jQuery=jquery,$=jquery,hammerjs'
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
}
]
},
resolve: { extensions: [ '.js', '.jsx', '.css' ] },
node: {
dns: 'empty',
net: 'empty',
fs: 'empty'
}
};