|
1 | 1 | var path = require('path'); |
2 | 2 | var webpack = require('webpack'); |
| 3 | +var ExtractTextPlugin = require('extract-text-webpack-plugin'); |
3 | 4 | var merge = require('extendify')({ isDeep: true, arrays: 'concat' }); |
4 | 5 | var devConfig = require('./webpack.config.dev'); |
5 | 6 | var prodConfig = require('./webpack.config.prod'); |
6 | 7 | var isDevelopment = process.env.ASPNET_ENV === 'Development'; |
| 8 | +var extractCSS = new ExtractTextPlugin('site.css'); |
7 | 9 |
|
8 | 10 | module.exports = merge({ |
9 | 11 | resolve: { |
10 | 12 | extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ] |
11 | 13 | }, |
12 | 14 | module: { |
13 | 15 | loaders: [ |
14 | | - { test: /\.ts(x?)$/, include: /ClientApp/, loader: 'babel-loader' }, |
15 | 16 | { test: /\.ts(x?)$/, include: /ClientApp/, loader: 'ts-loader' }, |
16 | | - { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' } |
| 17 | + { test: /\.css/, loader: extractCSS.extract(['css']) } |
17 | 18 | ] |
18 | 19 | }, |
19 | 20 | entry: { |
20 | | - main: ['./ClientApp/App.ts'], |
21 | | - vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'style-loader', 'jquery'] |
| 21 | + main: ['./ClientApp/App.ts'] |
22 | 22 | }, |
23 | 23 | output: { |
24 | 24 | path: path.join(__dirname, 'wwwroot', 'dist'), |
25 | 25 | filename: '[name].js', |
26 | 26 | publicPath: '/dist/' |
27 | 27 | }, |
28 | 28 | plugins: [ |
29 | | - new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable) |
30 | | - new webpack.optimize.OccurenceOrderPlugin(), |
31 | | - new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js') // Moves vendor content out of other bundles |
| 29 | + extractCSS, |
| 30 | + new webpack.DllReferencePlugin({ |
| 31 | + context: __dirname, |
| 32 | + manifest: require('./wwwroot/dist/vendor-manifest.json') |
| 33 | + }) |
32 | 34 | ] |
33 | 35 | }, isDevelopment ? devConfig : prodConfig); |
0 commit comments