mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Simplify webpack config. Eliminate dev/prod override files.
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
|
||||
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({
|
||||
resolve: {
|
||||
extensions: [ '', '.js', '.ts' ]
|
||||
},
|
||||
var isDevBuild = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
|
||||
var extractCSS = new ExtractTextPlugin('styles.css');
|
||||
|
||||
module.exports = {
|
||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
||||
resolve: { extensions: [ '', '.js', '.ts' ] },
|
||||
entry: { main: ['./ClientApp/boot-client.ts'] },
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts-loader?silent=true' },
|
||||
@@ -18,9 +16,6 @@ module.exports = merge({
|
||||
{ test: /\.css/, loader: extractCSS.extract(['css']) }
|
||||
]
|
||||
},
|
||||
entry: {
|
||||
main: ['./ClientApp/boot-client.ts']
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'wwwroot', 'dist'),
|
||||
filename: '[name].js',
|
||||
@@ -32,5 +27,9 @@ module.exports = merge({
|
||||
context: __dirname,
|
||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||
})
|
||||
]
|
||||
}, isDevelopment ? devConfig : prodConfig);
|
||||
].concat(isDevBuild ? [] : [
|
||||
// Plugins that apply in production builds only
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin()
|
||||
])
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user