-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
90 lines (86 loc) · 2.2 KB
/
Copy pathwebpack.config.dev.js
File metadata and controls
90 lines (86 loc) · 2.2 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const path = require('path');
const webpack = require('webpack');
const Dotenv = require('dotenv-webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: './client/public/index.html',
filename: 'index.html',
inject: 'body',
minify: {
collapseWhitespace: true,
collapseInlineTageWhitespace: true,
removeComments: true,
removeRedundantAttributes: true
}
});
module.exports = {
devtool: 'eval-source-map',
entry: [
'webpack-hot-middleware/client', path.join(__dirname, './client/src/Index.jsx')
],
output: {
path: path.join(__dirname, 'build/js'),
filename: 'bundle.js',
publicPath: '/',
},
module: {
loaders: [
{
test: /\.jsx?$/,
include: path.join(__dirname, 'client'),
exclude: /node_modules\//,
loader: 'babel-loader',
},
{
test: /\.s?css$/,
loader: [
'style-loader',
'css-loader',
'font-loader?format[]=truetype&format[]=woff&format[]=embedded-opentype',
]
},
{
test: /\.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
loader: 'file-loader?name=/fonts/[name].[ext]',
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?hash=sha512&digest=hex&name=[hash].[ext]', {
loader: 'image-webpack-loader',
query: {
mozjpeg: {
progressive: true,
},
gifsicle: {
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
pngquant: {
quality: '75-90',
speed: 3,
},
},
}],
exclude: /node_modules/,
},
]
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.HotModuleReplacementPlugin(),
new Dotenv({
path: path.resolve('./.env'),
safe: false,
systemvars: true,
}),
HtmlWebpackPluginConfig
]
};