mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Switch to Webpack
This commit is contained in:
33
templates/WebApplicationBasic/webpack.config.js
Normal file
33
templates/WebApplicationBasic/webpack.config.js
Normal file
@@ -0,0 +1,33 @@
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
|
||||
var devConfig = require('./webpack.config.dev');
|
||||
var prodConfig = require('./webpack.config.prod');
|
||||
var isDevelopment = process.env.ASPNET_ENV === 'Development';
|
||||
|
||||
module.exports = merge({
|
||||
resolve: {
|
||||
extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ]
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.ts(x?)$/, include: /ClientApp/, loader: 'babel-loader' },
|
||||
{ test: /\.ts(x?)$/, include: /ClientApp/, loader: 'ts-loader' },
|
||||
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
|
||||
]
|
||||
},
|
||||
entry: {
|
||||
main: ['./ClientApp/App.ts'],
|
||||
vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'style-loader', 'jquery']
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'wwwroot', 'dist'),
|
||||
filename: '[name].js',
|
||||
publicPath: '/dist/'
|
||||
},
|
||||
plugins: [
|
||||
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.optimize.CommonsChunkPlugin('vendor', 'vendor.js') // Moves vendor content out of other bundles
|
||||
]
|
||||
}, isDevelopment ? devConfig : prodConfig);
|
||||
Reference in New Issue
Block a user