Fix exception in healthcheck with http
[sdc.git] / catalog-ui / webpack.production.js
1 'use strict';
2
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 const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
12 var currentTime = new Date().getTime();
13
14 const params = {};
15
16 const webpackProdConfig = {
17     module: {
18         rules: [
19             {test: /\.(eot|svg)$/, loader: "file-loader?name=/scripts/fonts/[name].[hash:20].[ext]"},
20             {
21                 test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/,
22                 loader: "url-loader?name=/scripts/images/[name].[hash:20].[ext]&limit=10000"
23     }
24         ]
25     },
26     output: {
27         path: path.join(process.cwd(), "dist"),
28         filename: "[name]." + currentTime + ".bundle.js",
29         chunkFilename: "[id].chunk.js",
30         publicPath: "/sdc1"
31     },
32     plugins: [
33         new webpack.DefinePlugin({
34             __DEBUG__: JSON.stringify(false),
35             __ENV__: JSON.stringify('prod')
36         }),
37
38         new CopyWebpackPlugin([
39             {
40                 from: './src/index.html', transform: function (content, path) {
41                 content = (content + '').replace(/\.bundle.js/g, '.' + currentTime + '.bundle.jsgz');
42
43                 return content;
44             }
45             }
46         ]),
47         new UglifyJSPlugin({}),
48         new webpack.optimize.AggressiveMergingPlugin(),//Merge chunks
49         new CompressionPlugin({
50             asset: "[path]gz",
51             algorithm: "gzip",
52             test: /\.js$|\.css$|\.html$/
53         })
54     ]
55 };
56
57 module.exports = merge(webpackProdConfig, webpackCommonConfig(params));