3 const path = require('path');
4 const merge = require('webpack-merge');
5 const webpack = require('webpack');
6 const ServerConfig = require('./webpack.server');
7 const webpackCommonConfig = require('./webpack.common');
8 const {GlobCopyWebpackPlugin, BaseHrefWebpackPlugin} = require('@angular/cli/plugins/webpack');
9 const CopyWebpackPlugin = require('copy-webpack-plugin');
10 var CompressionPlugin = require('compression-webpack-plugin');
11 var currentTime = new Date().getTime();
15 const webpackProdConfig = {
18 {test: /\.(eot|svg)$/, loader: "file-loader?name=/scripts/fonts/[name].[hash:20].[ext]"},
20 test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/,
21 loader: "url-loader?name=/scripts/images/[name].[hash:20].[ext]&limit=10000"
26 path: path.join(process.cwd(), "dist"),
27 filename: "[name]." + currentTime + ".bundle.js",
28 chunkFilename: "[id].chunk.js",
32 new webpack.DefinePlugin({
33 __DEBUG__: JSON.stringify(false),
34 __ENV__: JSON.stringify('prod')
37 new CopyWebpackPlugin([
39 from: './src/index.html', transform: function (content, path) {
40 content = (content + '').replace(/\.bundle.js/g, '.' + currentTime + '.bundle.jsgz');
46 new webpack.optimize.UglifyJsPlugin({
58 new webpack.optimize.AggressiveMergingPlugin(),//Merge chunks
59 new CompressionPlugin({
62 test: /\.js$|\.css$|\.html$/
67 module.exports = merge(webpackProdConfig, webpackCommonConfig(params));