-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
61 lines (52 loc) · 1.51 KB
/
webpack.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
60
61
const webpack = require('webpack');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const ngtools = require('@ngtools/webpack');
var commonConfig = {
devtool: 'source-map',
entry: {
'index': './src/index.ts'
},
output: {
path: './dist/',
library: 'ng-password-helper',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
'@angular/core': { root: ['ng', 'core'], commonjs: '@angular/core', commonjs2: '@angular/core', amd: '@angular/core' },
'@angular/common': { root: ['ng', 'common'], commonjs: '@angular/common', commonjs2: '@angular/common', amd: '@angular/common' },
'@angular/forms': { root: ['ng', 'forms'], commonjs: '@angular/forms', commonjs2: '@angular/forms', amd: '@angular/forms' },
'rxjs/Rx': { root: 'Rx', commonjs: 'rxjs/Rx', commonjs2: 'rxjs/Rx', amd: 'rxjs/Rx' }
},
resolve: {
extensions: ['.ts']
},
module: {
loaders: [{
test: /\.ts$/,
//use: ['@ngtools/webpack']
use: ['awesome-typescript-loader']
}]
}
};
const uglify = {
plugins: [
new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
mangle: {
keep_fnames: true
}
})
]
};
const aot = {
plugins: [
new ngtools.AotPlugin({
tsConfigPath: './tsconfig-aot.json'
})
]
}
if (process.env.NODE_ENV && process.env.NODE_ENV.indexOf('prod') !== -1) {
module.exports = webpackMerge(commonConfig, uglify);
} else {
module.exports = webpackMerge(commonConfig);
}