mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
|
var path = require('path');
|
|
var webpack = require('webpack');
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
var bundleOutputDir = './wwwroot/dist';
|
|
module.exports = {
|
|
entry: { 'main': './ClientApp/boot.ts' },
|
|
resolve: { extensions: [ '', '.js', '.ts' ] },
|
|
output: {
|
|
path: path.join(__dirname, bundleOutputDir),
|
|
filename: '[name].js',
|
|
publicPath: '/dist/'
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts-loader', query: { silent: true } },
|
|
{ test: /\.html$/, loader: 'raw-loader' },
|
|
{ test: /\.css$/, loader: isDevBuild ? 'style-loader!css-loader' : ExtractTextPlugin.extract(['css-loader']) },
|
|
{ test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url-loader', query: { limit: 25000 } },
|
|
{ test: /\.json$/, loader: 'json-loader' }
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.DllReferencePlugin({
|
|
context: __dirname,
|
|
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
|
})
|
|
].concat(isDevBuild ? [
|
|
// Plugins that apply in development builds only
|
|
new webpack.SourceMapDevToolPlugin({
|
|
filename: '[file].map', // Remove this line if you prefer inline source maps
|
|
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
|
|
})
|
|
] : [
|
|
// Plugins that apply in production builds only
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
|
new ExtractTextPlugin('site.css')
|
|
])
|
|
};
|