-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
58 lines (54 loc) · 2.03 KB
/
Copy pathwebpack.config.js
File metadata and controls
58 lines (54 loc) · 2.03 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
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './client/app.jsx',
output: {
filename:'bundle.js',
path:path.resolve(__dirname, 'public/static/')
},
module:{
rules: [
{
test: /\.(js|jsx)?$/,
exclude: /node_modules/,
use: 'babel-loader'
}
]
},
// PLUGINS BELOW REDUCE BUNDLE SIZE FOR PRODUCTION
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: false
}), //minify
new webpack.optimize.AggressiveMergingPlugin()//Merging chunks
],
resolve: {
alias: {
// using preact and preactt-compact instead of react and react-dom
// react: 'preact-compat',
// 'react-dom': 'preact-compat',
// reducers here
bookReducers: path.resolve(__dirname, 'client/reducers/bookReducers.js'),
cartReducers: path.resolve(__dirname, 'client/reducers/cartReducers.js'),
// actions here
bookActions: path.resolve(__dirname, 'client/actions/bookActions.js'),
cartActions: path.resolve(__dirname, 'client/actions/cartActions.js'),
// Components here
Main: path.resolve(__dirname, 'client/components/Main.jsx'),
Book: path.resolve(__dirname, 'client/components/pages/Book.jsx'),
BookForm: path.resolve(__dirname, 'client/components/pages/BookForm.jsx'),
BookList: path.resolve(__dirname, 'client/components/pages/BookList.jsx'),
Cart: path.resolve(__dirname, 'client/components/pages/Cart.jsx'),
About: path.resolve(__dirname, 'client/components/pages/About.jsx'),
Contact: path.resolve(__dirname, 'client/components/pages/Contact.jsx'),
Navigation: path.resolve(__dirname, 'client/components/Navigation.jsx'),
Footer: path.resolve(__dirname, 'client/components/Footer.jsx'),
Slider: path.resolve(__dirname, 'client/components/Slider.jsx'),
}
}
}