forked from platanus/ng2-rut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
65 lines (60 loc) · 1.38 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
'use strict';
const webpack = require('webpack');
const path = require('path');
const srcPath = path.join(__dirname, 'demo', 'src');
const production = process.argv.indexOf('--dist') > -1;
const outPath = production ? 'dist' : 'build';
const devtool = production ? 'source-map' : 'eval-source-map';
const config = {
target: 'web',
cache: true,
entry: {
app: path.join(srcPath, 'demo-app.ts'),
common: [
'reflect-metadata/Reflect.js',
'zone.js/dist/zone.js',
],
},
resolve: {
root: srcPath,
extensions: ['', '.js', '.ts', '.html'],
modulesDirectories: ['node_modules'],
alias: {},
},
output: {
path: path.join(__dirname, 'demo', outPath),
publicPath: '',
filename: '[name].js',
pathInfo: true,
},
module: {
noParse: [],
loaders: [
{
test: /\.ts$/,
loader: 'ts',
},
{ test: /\.html/, loader: 'html?-minimize' },
],
},
ts: {
configFileName: 'tsconfig.demo.json',
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: 'common.js',
minChunks: Infinity,
}),
new webpack.NoErrorsPlugin(),
],
debug: true,
devtool,
};
if (production) {
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
mangle: false,
}));
config.plugins.push(new webpack.optimize.OccurrenceOrderPlugin(true));
}
module.exports = config;