-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.config.js
59 lines (58 loc) · 1.6 KB
/
webpack.prod.config.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
'use strict';
let path = require('path');
let webpack = require('webpack');
let CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
'main': './app/main.prod.ts',
'polyfills': './polyfills.ts'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js'
},
module: {
rules: [
{
test: /\.ts$/,
use: ['awesome-typescript?tsconfig=tsconfig.dev.json', 'angular2-template']
},
{
test: /\.html$/,
use: 'raw'
},
{
test: /\.scss$/,
use: ['raw', 'postcss', 'sass']
},
{
test: /\.css$/,
use: ['raw', 'postcss']
}
]
},
plugins: [
new CopyPlugin([
{from: './index.html', to: '.'},
{from: './assets', to: './assets'}
]),
new webpack.ProgressPlugin(),
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
path.join(process.cwd(), 'app')
),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
],
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, 'app')
],
extensions: ['.ts', '.js']
},
};