forked from michaelbromley/ngx-pagination
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
68 lines (64 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
65
66
67
68
'use strict';
var webpack = require('webpack');
var path = require('path');
var srcPath = path.join(__dirname, 'demo', 'src');
var production = -1 < process.argv.indexOf('--dist');
console.log('production', production);
var outPath = production ? 'dist' : 'build';
var devtool = production ? 'source-map' : 'eval-source-map';
var config = {
target: 'web',
cache: true,
entry: {
app: path.join(srcPath, 'demo-app.ts'),
common: [
'reflect-metadata/Reflect.js',
'es6-shim/es6-shim',
'zone.js/dist/zone.js'
]
},
resolve: {
root: srcPath,
extensions: ['', '.js', '.ts'],
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: /\.css/, loader: 'style!raw' },
{ test: /\.scss/, loader: 'style!css!sass' },
{ 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: devtool
};
if (production) {
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
mangle: false
}));
config.plugins.push(new webpack.optimize.OccurrenceOrderPlugin(true));
}
module.exports = config;