-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
115 lines (107 loc) · 3.1 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* eslint-disable no-var */
var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
var path = require('path');
const MATCH_ALL_NON_RELATIVE_IMPORTS = /^\w.*$/i;
const helpers = require('./helpers');
var common_config = {
module: {
preloaders: [
/**
* Tslint loader support for *.ts files
*
* See: https://github.com/wbuchwalter/tslint-loader
*/
{
test: /\.ts$/,
loader: 'tslint-loader',
exclude: [helpers.root('node_modules')]
},
],
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: 'awesome-typescript-loader',
exclude: [/\.(spec|e2e)\.ts$/]
},
// Support for .ts files.
{
test: /\.tsx$/,
loader: 'awesome-typescript-loader',
exclude: [/\.(spec|e2e)\.ts$/]
},
],
},
plugins: [
//new webpack.optimize.CommonsChunkPlugin({ name: ['frontend/index', 'frontend/polyfills', 'frontend/vendor'], minChunks: Infinity }),
],
// Other module loader config
tslint: {
emitErrors: true,
failOnHint: false,
resourcePath: 'frontend'
},
//externals: [MATCH_ALL_NON_RELATIVE_IMPORTS],
target: 'web',
// we need this due to problems with es6-shim
node: {
global: 'window',
progress: false,
crypto: 'empty',
module: false,
clearImmediate: false,
setImmediate: false
},
};
var frontend_config = {
output: {
filename: '[name].js',
libraryTarget: 'commonjs2',
//library: 'carte_blanche_angular2',
path: path.join(__dirname, 'dist'), // where to place webpack files
sourceMapFilename: '[name].map',
},
resolve: {
extensions: ['', '.js', '.jsx', '.ts', '.tsx']
},
entry: {
'frontend/index': './frontend/index.tsx',
},
};
var polyfill_config = {
output: {
filename: '[name].js',
//library: 'carte_blanche_angular2',
path: path.join(__dirname, 'dist'), // where to place webpack files
sourceMapFilename: '[name].map',
},
entry: {
'frontend/polyfills': './frontend/polyfills.ts',
},
};
var vendor_config = {
output: {
filename: '[name].js',
//library: 'carte_blanche_angular2',
path: path.join(__dirname, 'dist'), // where to place webpack files
sourceMapFilename: '[name].map',
},
entry: {
'frontend/vendor': './frontend/vendor.ts',
},
};
module.exports = [
// Frontend
webpackMerge({}, common_config, frontend_config),
// Polyfill
webpackMerge({}, common_config, polyfill_config),
// Vendor
webpackMerge({}, common_config, vendor_config),
]