| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  | const resolve = require('path').resolve; | 
					
						
							| 
									
										
										
										
											2017-05-11 14:17:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  | const pullAll = require('lodash/pullAll'); | 
					
						
							|  |  |  | const uniq = require('lodash/uniq'); | 
					
						
							| 
									
										
										
										
											2017-05-16 16:32:54 +02:00
										 |  |  | const merge = require('lodash/uniq'); | 
					
						
							| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 12:01:52 +02:00
										 |  |  | const StrapiPlugin = { | 
					
						
							| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * The DLL Plugin provides a dramatic speed increase to webpack build and hot module reloading | 
					
						
							|  |  |  |    * by caching the module metadata for all of our npm dependencies. We enable it by default | 
					
						
							|  |  |  |    * in development. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * To disable the DLL Plugin, set this value to false. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   dllPlugin: { | 
					
						
							|  |  |  |     defaults: { | 
					
						
							|  |  |  |       /** | 
					
						
							|  |  |  |        * we need to exclude dependencies which are not intended for the browser | 
					
						
							|  |  |  |        * by listing them here. | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |       exclude: [ | 
					
						
							|  |  |  |         'chalk', | 
					
						
							|  |  |  |         'compression', | 
					
						
							|  |  |  |         'cross-env', | 
					
						
							|  |  |  |         'express', | 
					
						
							|  |  |  |         'minimist', | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /** | 
					
						
							|  |  |  |        * Specify any additional dependencies here. We include core-js and lodash | 
					
						
							|  |  |  |        * since a lot of our dependencies depend on them and they get picked up by webpack. | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |       include: ['core-js', 'eventsource-polyfill', 'babel-polyfill', 'lodash'], | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // The path where the DLL manifest and bundle will get built
 | 
					
						
							| 
									
										
										
										
											2017-07-06 14:24:27 +02:00
										 |  |  |       path: resolve('node_modules', 'strapi-plugin-dlls'), | 
					
						
							| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 16:32:54 +02:00
										 |  |  |     entry(helperPkg, pluginPkg) { | 
					
						
							|  |  |  |       const dependencyNames = merge(Object.keys(helperPkg.dependencies), Object.keys(pluginPkg.dependencies)); | 
					
						
							| 
									
										
										
										
											2017-05-17 12:01:52 +02:00
										 |  |  |       const exclude = pluginPkg.dllPlugin.exclude || StrapiPlugin.dllPlugin.defaults.exclude; | 
					
						
							|  |  |  |       const include = pluginPkg.dllPlugin.include || StrapiPlugin.dllPlugin.defaults.include; | 
					
						
							| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  |       const includeDependencies = uniq(dependencyNames.concat(include)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       return { | 
					
						
							| 
									
										
										
										
											2017-05-17 12:01:52 +02:00
										 |  |  |         strapiPluginDeps: pullAll(includeDependencies, exclude), | 
					
						
							| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 12:01:52 +02:00
										 |  |  | module.exports = StrapiPlugin; |