1 | /**
|
2 | * Adapted from angular2-webpack-starter
|
3 | */
|
4 |
|
5 | const helpers = require('./helpers');
|
6 |
|
7 | /**
|
8 | * Webpack Plugins
|
9 | */
|
10 | const ProvidePlugin = require('webpack/lib/ProvidePlugin');
|
11 | const DefinePlugin = require('webpack/lib/DefinePlugin');
|
12 |
|
13 | const ENV = process.env.ENV = process.env.NODE_ENV = 'test';
|
14 |
|
15 | module.exports = {
|
16 |
|
17 | /**
|
18 | * Source map for Karma from the help of karma-sourcemap-loader & karma-webpack
|
19 | *
|
20 | * Do not change, leave as is or it wont work.
|
21 | * See: https://github.com/webpack/karma-webpack#source-maps
|
22 | */
|
23 | devtool: 'inline-source-map',
|
24 |
|
25 |
|
26 | resolve: {
|
27 | extensions: ['', '.ts', '.js'],
|
28 | root: helpers.root('')
|
29 | },
|
30 |
|
31 | module: {
|
32 |
|
33 | preLoaders: [
|
34 | // {
|
35 | // test: /\.ts$/,
|
36 | // loader: 'tslint-loader',
|
37 | // exclude: [helpers.root('node_modules')]
|
38 | // },
|
39 | {
|
40 | test: /\.js$/,
|
41 | loader: 'source-map-loader',
|
42 | exclude: [
|
43 | // these packages have problems with their sourcemaps
|
44 | helpers.root('node_modules/rxjs'),
|
45 | helpers.root('node_modules/@angular')
|
46 | ]
|
47 | }
|
48 | ],
|
49 |
|
50 | loaders: [
|
51 | {
|
52 | test: /\.ts$/,
|
53 | loader: 'awesome-typescript-loader',
|
54 | query: {
|
55 | compilerOptions: {
|
56 |
|
57 | // Remove TypeScript helpers to be injected
|
58 | // below by DefinePlugin
|
59 | removeComments: true
|
60 | }
|
61 | },
|
62 | exclude: [/\.e2e\.ts$/]
|
63 | }
|
64 | ]
|
65 |
|
66 | // postLoaders: [
|
67 | // {
|
68 | // test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader',
|
69 | // include: helpers.root('src'),
|
70 | // exclude: [
|
71 | // /\.(e2e|spec)\.ts$/,
|
72 | // /node_modules/
|
73 | // ]
|
74 | // }
|
75 | // ]
|
76 | },
|
77 |
|
78 | plugins: [
|
79 | new DefinePlugin({
|
80 | 'ENV': JSON.stringify(ENV),
|
81 | 'process.env': {
|
82 | 'ENV': JSON.stringify(ENV)
|
83 | }
|
84 | })
|
85 | ],
|
86 |
|
87 | tslint: {
|
88 | emitErrors: false,
|
89 | failOnHint: false,
|
90 | resourcePath: 'src'
|
91 | },
|
92 |
|
93 |
|
94 | node: {
|
95 | global: 'window',
|
96 | process: false,
|
97 | crypto: 'empty',
|
98 | module: false,
|
99 | clearImmediate: false,
|
100 | setImmediate: false
|
101 | }
|
102 |
|
103 | };
|