| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  | // #docregion
 | 
					
						
							|  |  |  | var webpack = require('webpack'); | 
					
						
							|  |  |  | var HtmlWebpackPlugin = require('html-webpack-plugin'); | 
					
						
							|  |  |  | var ExtractTextPlugin = require('extract-text-webpack-plugin'); | 
					
						
							|  |  |  | var helpers = require('./helpers'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = { | 
					
						
							|  |  |  |   // #docregion entries
 | 
					
						
							|  |  |  |   entry: { | 
					
						
							|  |  |  |     'polyfills': './src/polyfills.ts', | 
					
						
							|  |  |  |     'vendor': './src/vendor.ts', | 
					
						
							|  |  |  |     'app': './src/main.ts' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   // #enddocregion
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // #docregion resolve
 | 
					
						
							|  |  |  |   resolve: { | 
					
						
							| 
									
										
										
										
											2017-01-22 12:51:02 +01:00
										 |  |  |     extensions: ['.ts', '.js'] | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |   }, | 
					
						
							|  |  |  |   // #enddocregion resolve
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // #docregion loaders
 | 
					
						
							|  |  |  |   module: { | 
					
						
							| 
									
										
										
										
											2017-01-22 12:51:02 +01:00
										 |  |  |     rules: [ | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |       { | 
					
						
							|  |  |  |         test: /\.ts$/, | 
					
						
							| 
									
										
										
										
											2017-02-23 13:26:27 +01:00
										 |  |  |         loaders: [ | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             loader: 'awesome-typescript-loader', | 
					
						
							|  |  |  |             options: { configFileName: helpers.root('src', 'tsconfig.json') } | 
					
						
							|  |  |  |           } , 'angular2-template-loader' | 
					
						
							|  |  |  |         ] | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         test: /\.html$/, | 
					
						
							| 
									
										
										
										
											2017-01-22 12:51:02 +01:00
										 |  |  |         loader: 'html-loader' | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, | 
					
						
							| 
									
										
										
										
											2017-01-22 12:51:02 +01:00
										 |  |  |         loader: 'file-loader?name=assets/[name].[hash].[ext]' | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         test: /\.css$/, | 
					
						
							|  |  |  |         exclude: helpers.root('src', 'app'), | 
					
						
							| 
									
										
										
										
											2017-01-22 12:51:02 +01:00
										 |  |  |         loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader?sourceMap' }) | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         test: /\.css$/, | 
					
						
							|  |  |  |         include: helpers.root('src', 'app'), | 
					
						
							| 
									
										
										
										
											2017-01-22 12:51:02 +01:00
										 |  |  |         loader: 'raw-loader' | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   // #enddocregion loaders
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // #docregion plugins
 | 
					
						
							|  |  |  |   plugins: [ | 
					
						
							| 
									
										
										
										
											2017-01-22 12:51:02 +01:00
										 |  |  |     // Workaround for angular/angular#11580
 | 
					
						
							|  |  |  |     new webpack.ContextReplacementPlugin( | 
					
						
							|  |  |  |       // The (\\|\/) piece accounts for path separators in *nix and Windows
 | 
					
						
							|  |  |  |       /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, | 
					
						
							|  |  |  |       helpers.root('./src'), // location of your src
 | 
					
						
							|  |  |  |       {} // a map of your routes
 | 
					
						
							|  |  |  |     ), | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-13 19:20:51 +02:00
										 |  |  |     new webpack.optimize.CommonsChunkPlugin({ | 
					
						
							|  |  |  |       name: ['app', 'vendor', 'polyfills'] | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     new HtmlWebpackPlugin({ | 
					
						
							|  |  |  |       template: 'src/index.html' | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  |   // #enddocregion plugins
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | // #enddocregion
 | 
					
						
							|  |  |  | 
 |