-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.base.config.babel.js
70 lines (68 loc) · 1.65 KB
/
webpack.base.config.babel.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
import path from 'path';
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlPlugin from 'html-webpack-plugin';
const PATHS = {
src: path.join(__dirname, 'src'),
dist: path.join(__dirname, 'dist'),
assets: path.join(__dirname, 'src'),
};
export default {
devtool: 'eval',
entry: {
app: './src/index',
vendor: ['react', 'react-dom', 'redux', 'react-redux', 'react-router-dom'],
},
output: {
path: PATHS.dist,
filename: '[name].[chunkHash].js',
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{ loader: 'css-loader' },
{ loader: 'sass-loader' },
],
}),
},
{
test: /\.js$/,
use: ['babel-loader'],
exclude: /node_modules/,
include: PATHS.src,
},
{
test: /\.(eot|svg|ttf|png|jpg|woff(2)?)(\?v=\d+\.\d+\.\d+)?/,
use: 'url-loader?limit=1000',
},
],
},
resolve: {
modules: ['node_modules'],
},
plugins: [
new ExtractTextPlugin('app.css'),
function timestamp() {
this.plugin('watch-run', (watching, callback) => {
/* eslint-disable no-console */
console.log('Begin compile at %s', new Date());
callback();
/* eslint-enable no-console */
});
},
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: '[name].[chunkHash].js',
minChunks: Infinity,
}),
new HtmlPlugin({
title: 'List',
template: path.join(PATHS.src, 'index.html'),
inject: true,
}),
],
};