-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.base.js
71 lines (68 loc) · 1.64 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
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const autoprefixer = require('autoprefixer');
const buildPath = path.join(__dirname, './build');
const sourcePath = path.join(__dirname, './src');
module.exports = {
output: {
path: buildPath,
publicPath: '/',
filename: 'app-[hash].js',
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.(png|gif|jpg|jpeg|svg)$/,
include: path.join(__dirname, './src/assets/img'),
use: 'url-loader?limit=20480&name=assets/[name]-[hash].[ext]',
}
]
},
resolve: {
extensions: [
'.webpack-loader.js',
'.web-loader.js',
'.loader.js',
'.js',
'.jsx',
'.json',
'.scss'
],
modules: [
path.resolve(__dirname, 'node_modules'),
path.join(__dirname, './src/js'),
],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor-[hash].js',
}),
new webpack.NamedModulesPlugin(),
new HtmlWebpackPlugin({
template: path.join(sourcePath, 'index.html'),
path: buildPath,
filename: 'index.html',
}),
new webpack.LoaderOptionsPlugin({
options: {
postcss: [
autoprefixer({
browsers: [
'last 3 version',
'ie >= 10',
],
}),
],
context: sourcePath,
},
}),
]
};