forked from r-park/todo-angular-firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dist.js
73 lines (66 loc) · 2.04 KB
/
webpack.dist.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
const path = require('path');
const webpack = require('webpack');
const config = require('./webpack.base');
// plugins
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
const DedupePlugin = webpack.optimize.DedupePlugin;
const DefinePlugin = webpack.DefinePlugin;
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const OccurenceOrderPlugin = webpack.optimize.OccurenceOrderPlugin;
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
module.exports = {
cache: true,
debug: true,
devtool: 'source-map',
entry: config.entry,
output: config.output,
resolve: config.resolve,
postcss: config.postcss,
sassLoader: config.sassLoader,
module: {
loaders: [
{test: /\.ts$/, exclude: [/\.spec\.ts$/, /node_modules/], loader: 'ts'},
{test: /\.scss$/, include: [path.resolve(__dirname, 'src/views/common/styles')], loader: ExtractTextPlugin.extract('css!postcss-loader!sass')},
{test: /\.scss$/, exclude: [path.resolve(__dirname, 'src/views/common/styles')], include: [path.resolve(__dirname, 'src/views')], loader: 'raw!postcss-loader!sass'},
{test: /\.html$/, loader: 'raw'}
],
noParse: config.module.noParse
},
plugins: [
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new ExtractTextPlugin('styles.css'),
new DedupePlugin(),
new OccurenceOrderPlugin(),
new CommonsChunkPlugin({name: 'vendor', filename: 'vendor.js', minChunks: Infinity}),
new HtmlWebpackPlugin({
chunksSortMode: 'none',
filename: 'index.html',
hash: true,
inject: 'body',
template: './src/index.html'
}),
new UglifyJsPlugin({
compress: {
dead_code: true,
screw_ie8: true,
unused: true,
warnings: false
},
mangle: false
})
],
stats: {
cached: true,
cachedAssets: true,
chunks: true,
chunkModules: true,
colors: true,
hash: false,
reasons: false,
timings: true,
version: false
}
};