-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.umd.js
70 lines (69 loc) · 2.12 KB
/
webpack.config.umd.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
62
63
64
65
66
67
68
69
70
const path = require('path');
// Webpack and its plugins
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
const CompressionPlugin = require('compression-webpack-plugin');
const DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const ENV = process.env.NODE_ENV = 'production';
const metadata = {
env: ENV
};
module.exports = {
devtool: 'source-map',
entry: './src/index.ts',
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/platform-browser': {
root: ['ng', 'platformBrowser'],
commonjs: '@angular/platform-browser',
commonjs2: '@angular/platform-browser',
amd: '@angular/platform-browser'
},
'rxjs/Subscription': {
root: ['rx', 'Subscription'],
commonjs: 'rxjs/Subscription',
commonjs2: 'rxjs/Subscription',
amd: 'rxjs/Subscription'
}
},
module: {
loaders: [
{ test: /\.css$/, loader: 'raw', exclude: /node_modules/ },
{ test: /\.css$/, loader: 'style!css?-minimize', exclude: /src/ },
{ test: /\.html$/, loader: 'raw' },
{ test: /\.ts$/, loader: 'ts-loader', query: { compilerOptions: { noEmit: false } } }
]
},
output: {
path: path.resolve(__dirname, 'dist/umd'),
filename: 'angular-lib-exp.js',
libraryTarget: 'umd',
library: 'angular-lib-exp'
},
plugins: [
new StyleLintPlugin({
syntax: 'scss',
context: 'scss',
failOnError: true
}),
new CompressionPlugin({ regExp: /\.css$|\.html$|\.js$|\.map$/ })
],
resolve: {
extensions: ['tsx', '.ts', '.js'],
modules: [path.resolve(__dirname, 'node_modules')]
}
};