mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Simplify webpack config. Eliminate dev/prod override files.
This commit is contained in:
@@ -34,7 +34,6 @@
|
|||||||
"css-loader": "^0.25.0",
|
"css-loader": "^0.25.0",
|
||||||
"es6-shim": "^0.35.1",
|
"es6-shim": "^0.35.1",
|
||||||
"expose-loader": "^0.7.1",
|
"expose-loader": "^0.7.1",
|
||||||
"extendify": "^1.0.0",
|
|
||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.9.0",
|
"file-loader": "^0.9.0",
|
||||||
"isomorphic-fetch": "^2.2.1",
|
"isomorphic-fetch": "^2.2.1",
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
devtool: 'inline-source-map'
|
|
||||||
};
|
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
|
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
var extractCSS = new ExtractTextPlugin('styles.css');
|
|
||||||
var devConfig = require('./webpack.config.dev');
|
|
||||||
var prodConfig = require('./webpack.config.prod');
|
|
||||||
var isDevelopment = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
|
|
||||||
|
|
||||||
module.exports = merge({
|
var isDevBuild = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
|
||||||
resolve: {
|
var extractCSS = new ExtractTextPlugin('styles.css');
|
||||||
extensions: [ '', '.js', '.ts' ]
|
|
||||||
},
|
module.exports = {
|
||||||
|
devtool: isDevBuild ? 'inline-source-map' : null,
|
||||||
|
resolve: { extensions: [ '', '.js', '.ts' ] },
|
||||||
|
entry: { main: ['./ClientApp/boot-client.ts'] },
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts-loader?silent=true' },
|
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts-loader?silent=true' },
|
||||||
@@ -18,9 +16,6 @@ module.exports = merge({
|
|||||||
{ test: /\.css/, loader: extractCSS.extract(['css']) }
|
{ test: /\.css/, loader: extractCSS.extract(['css']) }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
|
||||||
main: ['./ClientApp/boot-client.ts']
|
|
||||||
},
|
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, 'wwwroot', 'dist'),
|
path: path.join(__dirname, 'wwwroot', 'dist'),
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
@@ -32,5 +27,9 @@ module.exports = merge({
|
|||||||
context: __dirname,
|
context: __dirname,
|
||||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||||
})
|
})
|
||||||
]
|
].concat(isDevBuild ? [] : [
|
||||||
}, isDevelopment ? devConfig : prodConfig);
|
// Plugins that apply in production builds only
|
||||||
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
|
new webpack.optimize.UglifyJsPlugin()
|
||||||
|
])
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
var webpack = require('webpack');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
plugins: [
|
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
|
||||||
compress: { warnings: false },
|
|
||||||
minimize: true,
|
|
||||||
mangle: false // Due to https://github.com/angular/angular/issues/6678
|
|
||||||
})
|
|
||||||
]
|
|
||||||
};
|
|
||||||
@@ -49,10 +49,6 @@ module.exports = {
|
|||||||
name: '[name]_[hash]'
|
name: '[name]_[hash]'
|
||||||
})
|
})
|
||||||
].concat(isDevelopment ? [] : [
|
].concat(isDevelopment ? [] : [
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })
|
||||||
compress: { warnings: false },
|
|
||||||
minimize: true,
|
|
||||||
mangle: false // Due to https://github.com/angular/angular/issues/6678
|
|
||||||
})
|
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user