| 
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | const ExternalsPlugin = require("../ExternalsPlugin"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-09 05:59:19 +08:00
										 |  |  | /** @typedef {import("../Compiler")} Compiler */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | const builtins = | 
					
						
							| 
									
										
										
										
											2018-11-02 18:04:02 +08:00
										 |  |  | 	// eslint-disable-next-line node/no-unsupported-features/node-builtins,node/no-deprecated-api
 | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 	require("module").builtinModules || Object.keys(process.binding("natives")); | 
					
						
							| 
									
										
										
										
											2018-01-28 05:05:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | class NodeTargetPlugin { | 
					
						
							| 
									
										
										
										
											2018-11-09 05:59:19 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2020-04-23 16:48:36 +08:00
										 |  |  | 	 * Apply the plugin | 
					
						
							| 
									
										
										
										
											2018-11-09 05:59:19 +08:00
										 |  |  | 	 * @param {Compiler} compiler the compiler instance | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | 	apply(compiler) { | 
					
						
							| 
									
										
										
										
											2018-01-28 05:05:15 +08:00
										 |  |  | 		new ExternalsPlugin("commonjs", builtins).apply(compiler); | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-03-06 02:56:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 |  |  | module.exports = NodeTargetPlugin; |