Skip to content

Commit 4ea7eb1

Browse files
Simplify webpack config. Eliminate dev/prod override files.
1 parent 85dfdd9 commit 4ea7eb1

File tree

5 files changed

+13
-34
lines changed

5 files changed

+13
-34
lines changed

templates/Angular2Spa/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"css-loader": "^0.25.0",
3535
"es6-shim": "^0.35.1",
3636
"expose-loader": "^0.7.1",
37-
"extendify": "^1.0.0",
3837
"extract-text-webpack-plugin": "^1.0.1",
3938
"file-loader": "^0.9.0",
4039
"isomorphic-fetch": "^2.2.1",

templates/Angular2Spa/webpack.config.dev.js

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
var path = require('path');
22
var webpack = require('webpack');
3-
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
43
var ExtractTextPlugin = require('extract-text-webpack-plugin');
4+
5+
var isDevBuild = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
56
var extractCSS = new ExtractTextPlugin('styles.css');
6-
var devConfig = require('./webpack.config.dev');
7-
var prodConfig = require('./webpack.config.prod');
8-
var isDevelopment = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
97

10-
module.exports = merge({
11-
resolve: {
12-
extensions: [ '', '.js', '.ts' ]
13-
},
8+
module.exports = {
9+
devtool: isDevBuild ? 'inline-source-map' : null,
10+
resolve: { extensions: [ '', '.js', '.ts' ] },
11+
entry: { main: ['./ClientApp/boot-client.ts'] },
1412
module: {
1513
loaders: [
1614
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts-loader?silent=true' },
1715
{ test: /\.html$/, loader: 'raw-loader' },
1816
{ test: /\.css/, loader: extractCSS.extract(['css']) }
1917
]
2018
},
21-
entry: {
22-
main: ['./ClientApp/boot-client.ts']
23-
},
2419
output: {
2520
path: path.join(__dirname, 'wwwroot', 'dist'),
2621
filename: '[name].js',
@@ -32,5 +27,9 @@ module.exports = merge({
3227
context: __dirname,
3328
manifest: require('./wwwroot/dist/vendor-manifest.json')
3429
})
35-
]
36-
}, isDevelopment ? devConfig : prodConfig);
30+
].concat(isDevBuild ? [] : [
31+
// Plugins that apply in production builds only
32+
new webpack.optimize.OccurenceOrderPlugin(),
33+
new webpack.optimize.UglifyJsPlugin()
34+
])
35+
};

templates/Angular2Spa/webpack.config.prod.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

templates/Angular2Spa/webpack.config.vendor.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ module.exports = {
4949
name: '[name]_[hash]'
5050
})
5151
].concat(isDevelopment ? [] : [
52-
new webpack.optimize.UglifyJsPlugin({
53-
compress: { warnings: false },
54-
minimize: true,
55-
mangle: false // Due to https://github.com/angular/angular/issues/6678
56-
})
52+
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })
5753
])
5854
};

0 commit comments

Comments
 (0)