| 
									
										
										
										
											2017-09-14 19:47:33 -07:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2017-08-15 10:22:55 -07:00
										 |  |  | const ngtools = require('@ngtools/webpack'); | 
					
						
							|  |  |  | const webpack = require('webpack'); | 
					
						
							| 
									
										
										
										
											2017-09-14 19:47:33 -07:00
										 |  |  | const CopyWebpackPlugin = require('copy-webpack-plugin'); | 
					
						
							| 
									
										
										
										
											2017-08-15 10:22:55 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | module.exports = { | 
					
						
							|  |  |  |   devtool: 'source-map', | 
					
						
							|  |  |  |   entry: { | 
					
						
							|  |  |  |     main: [ | 
					
						
							|  |  |  |       './src/universal/app-server.module.ts', | 
					
						
							|  |  |  |       './src/universal/server.ts' | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   resolve: { | 
					
						
							|  |  |  |     extensions: ['.ts', '.js'] | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   target: 'node', | 
					
						
							|  |  |  |   output: { | 
					
						
							| 
									
										
										
										
											2017-10-06 14:34:29 -07:00
										 |  |  |     path: __dirname + '/dist', | 
					
						
							| 
									
										
										
										
											2017-08-15 10:22:55 -07:00
										 |  |  |     filename: 'server.js' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   plugins: [ | 
					
						
							| 
									
										
										
										
											2017-09-14 19:47:33 -07:00
										 |  |  |     // compile with AOT
 | 
					
						
							| 
									
										
										
										
											2017-08-15 10:22:55 -07:00
										 |  |  |     new ngtools.AotPlugin({ | 
					
						
							| 
									
										
										
										
											2017-09-14 19:47:33 -07:00
										 |  |  |       tsConfigPath: './tsconfig.universal.json' | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // copy assets to the output (/dist) folder
 | 
					
						
							|  |  |  |     new CopyWebpackPlugin([ | 
					
						
							|  |  |  |       {from: 'src/index-universal.html'}, | 
					
						
							|  |  |  |       {from: 'src/styles.css'}, | 
					
						
							|  |  |  |       {from: 'node_modules/core-js/client/shim.min.js'}, | 
					
						
							|  |  |  |       {from: 'node_modules/zone.js/dist/zone.min.js'}, | 
					
						
							|  |  |  |   ]) | 
					
						
							| 
									
										
										
										
											2017-08-15 10:22:55 -07:00
										 |  |  |   ], | 
					
						
							|  |  |  |   module: { | 
					
						
							|  |  |  |     rules: [ | 
					
						
							| 
									
										
										
										
											2017-09-14 19:47:33 -07:00
										 |  |  |       { test: /\.css$/,  loader: 'raw-loader' }, | 
					
						
							| 
									
										
										
										
											2017-08-15 10:22:55 -07:00
										 |  |  |       { test: /\.html$/, loader: 'raw-loader' }, | 
					
						
							| 
									
										
										
										
											2017-09-14 19:47:33 -07:00
										 |  |  |       { test: /\.ts$/,   loader: '@ngtools/webpack' } | 
					
						
							| 
									
										
										
										
											2017-08-15 10:22:55 -07:00
										 |  |  |     ] | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |