-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.base.js
80 lines (75 loc) · 1.71 KB
/
webpack.config.base.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
// Common Webpack configuration: used by others webpack configurations
const path = require('path');
const webpack = require('webpack');
const BINARY_FILE_MAX_SIZE = 8192;
const BASE_DIR = 'src';
const OUTPUR_DIR = 'build';
const JS_CUSTOM_APP_NAME = 'js/[name].js';
const JS_COMMON_VENDOR_NAME = 'js/vendor.bundle.js';
module.exports = {
entry: {
vendor: [
'react',
'react-dom',
'react-redux',
'react-bootstrap',
'redux'
]
},
output: {
filename: 'js/[name].js',
path: path.resolve(__dirname, OUTPUR_DIR),
publicPath: '/'
},
resolve: {
modules: [
path.join(__dirname, BASE_DIR),
'node_modules'
],
extensions: ['.js', '.jsx', '.json', '.scss']
},
plugins: [
// Shared code
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'js/vendor.bundle.js',
minChunks: Infinity
})
],
module: {
loaders: [
// JavaScript / ES6
{
test: /\.(jsx|js)$/,
include: path.resolve(__dirname, 'src'),
loader: 'babel-loader'
},
// JSON
{
test: /\.(json)$/,
loader: 'json-loader'
},
// Images
// Inline base64 URLs for <=8k images, direct URLs for the rest
{
test: /\.(png|jpg|jpeg|gif|svg)$/,
loader: 'url-loader',
query: {
limit: BINARY_FILE_MAX_SIZE,
name: 'images/[name].[ext]?[hash]'
}
},
// Fonts
{
test: /\.(woff|woff2|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
loaders: [{
loader: 'url-loader',
query: {
limit: BINARY_FILE_MAX_SIZE,
name: 'theme/[name].[ext]?[hash]'
}
}]
}
]
}
};