-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
64 lines (55 loc) · 1.71 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
62
63
64
var path = require('path');
var webpack = require('webpack');
module.exports = {
context: __dirname + "/src",
devtool: '#source-map',
debug: true,
// cache: false,
// our angular app
entry: { app: './app.ts'},
// Config for our build files
output: {
path: __dirname + "/dist",
filename: '[name].bundle.js',
sourceMapFilename: '[name].map',
chunkFilename: '[id].chunk.js'
},
resolve: {
// ensure loader extensions match
extensions: prepend(['.ts','.js','.json','.css','.html'], '.async') // ensure .async.ts etc also works
},
module: {
preLoaders: [
{ test: /\.js$/, loader: "source-map-loader", exclude: [ __dirname + 'node_modules/rxjs' ] }
],
loaders: [
// Support Angular 2 async routes via .async.ts
{ test: /\.async\.ts$/, loaders: ['es6-promise-loader', 'ts-loader'], exclude: [ /\.(spec|e2e)\.ts$/ ] },
// Support for .ts files.
{ test: /\.ts$/, loader: 'ts-loader', exclude: [ /\.(spec|e2e|async)\.ts$/ ] },
// Support for *.json files.
{ test: /\.json$/, loader: 'json-loader' }
]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(true)
],
// Other module loader config
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: 'src'
},
// we need this due to problems with es6-shim
node: {global: 'window', progress: false, crypto: 'empty', module: false, clearImmediate: false, setImmediate: false}
};
// Helper functions
function prepend(extensions, args) {
args = args || [];
if (!Array.isArray(args)) { args = [args] }
return extensions.reduce(function(memo, val) {
return memo.concat(val, args.map(function(prefix) {
return prefix + val
}));
}, ['']);
}