-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.karma.config.js
86 lines (83 loc) · 2.74 KB
/
webpack.karma.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
var webpack = require('webpack');
var path = require('path');
var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
var client = path.join(__dirname, 'client');
var node_modules = path.join(__dirname, 'node_modules');
var vendor = path.join(__dirname, 'vendor');
var settings = require('./gulp.config')();
module.exports = function(coverage) {
var config = {
debug: true,
cache: true,
module: {
noParse: [
/zone\.js\/dist\/.+/,
/angular2\/bundles\/.+/
],
loaders: [
{
test: /\.ts$/,
loader: 'ts-loader',
query: {
'ignoreDiagnostics': [
2403, // 2403 -> Subsequent variable declarations
2300, // 2300 -> Duplicate identifier
2374, // 2374 -> Duplicate number index signature
2375 // 2375 -> Duplicate string index signature
],
'transpileOnly': true,
'isolatedModules': true
},
exclude: [ /node_modules\/(?!(ng2-.+))/ ]
},
{
test: /\.html$/,
loader: 'raw',
exclude: [
path.resolve(__dirname, '.awcache'),
path.resolve(__dirname, 'vendor'),
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'bower_components')
]
}
]
},
stats: {colors: true, reasons: true},
resolve: {
alias: settings.aliases,
extensions: ['', '.js', '.ts'],
modulesDirectories: ['node_modules', 'client', 'target']
},
plugins: [
// Dll references
new webpack.DllReferencePlugin({
context: path.join(__dirname, './'),
manifest: require('./client/assets/lib/common-manifest.json')
})
]
};
if (coverage) {
config.module.postLoaders = [
{
test: /\.(js)$/,
loader: 'istanbul-instrumenter-loader',
exclude: [
/\.spec\.js$/,
/test\.js$/,
/testing/,
/node_modules/
]
}
]
}
else {
config.devtool = 'inline-source-map';
config.module.preLoaders = [
{
test: /\.js$/,
loader: "source-map-loader"
}
]
}
return config;
};