-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
62 lines (59 loc) · 1.7 KB
/
webpack.common.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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var autoprefixer = require('autoprefixer');
var SRC_PATH = path.resolve(__dirname, './src');
module.exports = {
devtool: 'source-map',
entry: {
vendor: ['regularjs', 'axios', 'store', 'stateman', 'restate'],
app: ['./src/index.js']
},
output: {
path: __dirname + '/build',
filename: "[name].[chunkhash].js"
},
resolve: {
alias: {
restate: path.resolve(__dirname, './src/lib/restate.js')
}
},
module: {
loaders: [
{ test: /\.html$/, loader: 'raw' },
{ test: /\.rgl$/, loader: 'rgl' },
{
test: /\.js$/,
include: SRC_PATH,
loader: 'babel'
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', ['css-loader', 'postcss-loader', 'sass-loader']),
incldue: SRC_PATH
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url',
query: {
limit: 10000,
name: '[name].[hash:5].[ext]'
}
}
]
},
plugins: [
new ExtractTextPlugin('style.[contenthash:5].css',{
allChunks: true
}),
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.[hash:5].js"),
new HtmlWebpackPlugin({
template: './index.html',
inject: 'body'
})
],
postcss: [
autoprefixer
]
}