mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
var path = require('path');
|
|
var webpack = require('webpack');
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
var extractCSS = new ExtractTextPlugin('vendor.css');
|
|
var isDevelopment = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
|
|
|
|
module.exports = {
|
|
resolve: {
|
|
extensions: [ '', '.js' ]
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' },
|
|
{ test: /\.css/, loader: extractCSS.extract(['css']) }
|
|
]
|
|
},
|
|
entry: {
|
|
vendor: [
|
|
'bootstrap',
|
|
'bootstrap/dist/css/bootstrap.css',
|
|
'es6-shim',
|
|
'style-loader',
|
|
'jquery',
|
|
'@angular/common',
|
|
'@angular/compiler',
|
|
'@angular/core',
|
|
'@angular/http',
|
|
'@angular/platform-browser',
|
|
'@angular/platform-browser-dynamic',
|
|
'@angular/router',
|
|
'@angular/platform-server',
|
|
]
|
|
},
|
|
output: {
|
|
path: path.join(__dirname, 'wwwroot', 'dist'),
|
|
filename: '[name].js',
|
|
library: '[name]_[hash]',
|
|
},
|
|
plugins: [
|
|
extractCSS,
|
|
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
new webpack.DllPlugin({
|
|
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
|
|
name: '[name]_[hash]'
|
|
})
|
|
].concat(isDevelopment ? [] : [
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
compress: { warnings: false },
|
|
minimize: true,
|
|
mangle: false // Due to https://github.com/angular/angular/issues/6678
|
|
})
|
|
])
|
|
};
|