| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  | const webpack = require('webpack'); | 
					
						
							|  |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2018-02-06 13:53:56 -08:00
										 |  |  | const UglifyPlugin = require('uglifyjs-webpack-plugin'); | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | const __DEV__ = process.env.NODE_ENV !== 'production'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = { | 
					
						
							| 
									
										
										
										
											2018-01-09 08:08:14 -08:00
										 |  |  |   entry: './client/frame-runner.js', | 
					
						
							| 
									
										
										
										
											2018-02-06 13:53:56 -08:00
										 |  |  |   devtool: __DEV__ ? 'inline-source-map' : 'source-map', | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  |   node: { | 
					
						
							|  |  |  |     // Mock Node.js modules that Babel require()s but that we don't
 | 
					
						
							|  |  |  |     // particularly care about.
 | 
					
						
							|  |  |  |     fs: 'empty', | 
					
						
							|  |  |  |     module: 'empty', | 
					
						
							|  |  |  |     net: 'empty' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   output: { | 
					
						
							| 
									
										
										
										
											2018-01-09 08:08:14 -08:00
										 |  |  |     filename: __DEV__ ? 'frame-runner.js' : 'frame-runner-[hash].js', | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  |     path: path.join(__dirname, '/public/js'), | 
					
						
							|  |  |  |     publicPath: '/js' | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2018-01-09 08:08:14 -08:00
										 |  |  |   stats: { | 
					
						
							|  |  |  |     // Examine all modules
 | 
					
						
							|  |  |  |     maxModules: Infinity, | 
					
						
							|  |  |  |     // Display bailout reasons
 | 
					
						
							|  |  |  |     optimizationBailout: true | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  |   module: { | 
					
						
							| 
									
										
										
										
											2018-01-09 08:08:14 -08:00
										 |  |  |     rules: [{ | 
					
						
							|  |  |  |       test: /\.jsx?$/, | 
					
						
							|  |  |  |       include: [ path.join(__dirname, 'client/') ], | 
					
						
							|  |  |  |       use: { | 
					
						
							|  |  |  |         loader: 'babel-loader', | 
					
						
							|  |  |  |         options: { | 
					
						
							|  |  |  |           babelrc: false, | 
					
						
							|  |  |  |           presets: [ | 
					
						
							|  |  |  |             [ 'es2015', { modules: false }], | 
					
						
							|  |  |  |             [ 'stage-3' ] | 
					
						
							|  |  |  |           ], | 
					
						
							|  |  |  |           plugins: [ | 
					
						
							|  |  |  |             'transform-runtime', | 
					
						
							|  |  |  |             'lodash' | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-01-09 08:08:14 -08:00
										 |  |  |     }] | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   externals: { | 
					
						
							|  |  |  |     rx: 'Rx' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   plugins: [ | 
					
						
							|  |  |  |     new webpack.DefinePlugin({ | 
					
						
							|  |  |  |       'process.env': { | 
					
						
							|  |  |  |         NODE_ENV: JSON.stringify(__DEV__ ? 'development' : 'production') | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       __DEVTOOLS__: !__DEV__ | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  |     // Use browser version of visionmedia-debug
 | 
					
						
							|  |  |  |     new webpack.NormalModuleReplacementPlugin( | 
					
						
							|  |  |  |       /debug\/node/, | 
					
						
							|  |  |  |       'debug/src/browser' | 
					
						
							|  |  |  |     ), | 
					
						
							| 
									
										
										
										
											2018-01-09 08:08:14 -08:00
										 |  |  |     new webpack.optimize.ModuleConcatenationPlugin() | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  |   ] | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (__DEV__) { | 
					
						
							|  |  |  |   module.exports.plugins.push( | 
					
						
							|  |  |  |     // prevents build on error
 | 
					
						
							| 
									
										
										
										
											2018-01-09 08:08:14 -08:00
										 |  |  |     new webpack.NoEmitOnErrorsPlugin() | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  |   ); | 
					
						
							| 
									
										
										
										
											2018-02-06 13:53:56 -08:00
										 |  |  | } else { | 
					
						
							|  |  |  |   module.exports.plugins.push( | 
					
						
							|  |  |  |     new UglifyPlugin({ | 
					
						
							|  |  |  |       test: /\.js($|\?)/i, | 
					
						
							|  |  |  |       cache: true, | 
					
						
							|  |  |  |       sourceMap: true | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   ); | 
					
						
							| 
									
										
										
										
											2018-01-09 06:41:18 -08:00
										 |  |  | } |