[SDC-29] catalog 1707 rebase commit.
[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
11 const params = {
12     // entryPoints: [
13     //     '/sdc1/scripts/inline',
14     //     '/sdc1/scripts/polyfills',
15     //     '/sdc1/scripts/vendor',
16     //     '/sdc1/scripts/main',
17     //     '/sdc1/scripts/sw-register',
18     //     '/sdc1/scripts/scripts',
19     //     '/sdc1/scripts/styles'
20     // ]
21 };
22
23 const webpackProdConfig = {
24     module: {
25             rules: [
26                 { test: /\.(eot|svg)$/, loader: "file-loader?name=/scripts/fonts/[name].[hash:20].[ext]" },
27                 { test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/, loader: "url-loader?name=/scripts/images/[name].[hash:20].[ext]&limit=10000" }
28             ]
29     },
30     output: {
31         path: path.join(process.cwd(), "dist"),
32         filename: "[name].bundle.js",
33         chunkFilename: "[id].chunk.js",
34         publicPath: "/sdc1"
35     },
36         plugins: [
37         new webpack.DefinePlugin({
38             __DEBUG__: JSON.stringify(false),
39             __ENV__: JSON.stringify('prod')
40         }),
41         new CopyWebpackPlugin([
42             { from: './src/index.html'}  
43         ]),
44                 new webpack.optimize.UglifyJsPlugin({
45             beautify: false,
46             mangle: {
47                 screw_ie8: true,
48                 keep_fnames: true
49             },
50             compress: {
51                 warnings: false,
52                 screw_ie8: true
53             },
54             comments: false
55         })
56         ]
57 };
58
59 module.exports = merge(webpackProdConfig, webpackCommonConfig(params));