mirror of https://github.com/webpack/webpack.git
				
				
				
			allow to disable compareBeforeEmit
This commit is contained in:
		
							parent
							
								
									019e35bf26
								
							
						
					
					
						commit
						07671f3481
					
				|  | @ -1180,6 +1180,10 @@ export interface OutputOptions { | |||
| 	 * Number of milliseconds before chunk request expires | ||||
| 	 */ | ||||
| 	chunkLoadTimeout?: number; | ||||
| 	/** | ||||
| 	 * Check if to be emitted file already exists and have the same content before writing to output filesystem | ||||
| 	 */ | ||||
| 	compareBeforeEmit?: boolean; | ||||
| 	/** | ||||
| 	 * This option enables cross-origin loading of chunks. | ||||
| 	 */ | ||||
|  |  | |||
|  | @ -581,15 +581,19 @@ class Compiler { | |||
| 							} | ||||
| 						} | ||||
| 
 | ||||
| 						this.outputFileSystem.stat(targetPath, (err, stats) => { | ||||
| 							const exists = !err && stats.isFile(); | ||||
| 						if (this.options.output.compareBeforeEmit) { | ||||
| 							this.outputFileSystem.stat(targetPath, (err, stats) => { | ||||
| 								const exists = !err && stats.isFile(); | ||||
| 
 | ||||
| 							if (exists) { | ||||
| 								processExistingFile(stats); | ||||
| 							} else { | ||||
| 								processMissingFile(); | ||||
| 							} | ||||
| 						}); | ||||
| 								if (exists) { | ||||
| 									processExistingFile(stats); | ||||
| 								} else { | ||||
| 									processMissingFile(); | ||||
| 								} | ||||
| 							}); | ||||
| 						} else { | ||||
| 							processMissingFile(); | ||||
| 						} | ||||
| 					}; | ||||
| 
 | ||||
| 					if (targetFile.match(/\/|\\/)) { | ||||
|  |  | |||
|  | @ -232,6 +232,7 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { | |||
| 		this.set("output.webassemblyModuleFilename", "[hash].module.wasm"); | ||||
| 		this.set("output.library", ""); | ||||
| 		this.set("output.publicPath", ""); | ||||
| 		this.set("output.compareBeforeEmit", true); | ||||
| 		this.set("output.hotUpdateFunction", "make", options => { | ||||
| 			return Template.toIdentifier( | ||||
| 				"webpackHotUpdate" + Template.toIdentifier(options.output.library) | ||||
|  |  | |||
|  | @ -1123,6 +1123,10 @@ | |||
|           "description": "Number of milliseconds before chunk request expires", | ||||
|           "type": "number" | ||||
|         }, | ||||
|         "compareBeforeEmit": { | ||||
|           "description": "Check if to be emitted file already exists and have the same content before writing to output filesystem", | ||||
|           "type": "boolean" | ||||
|         }, | ||||
|         "crossOriginLoading": { | ||||
|           "description": "This option enables cross-origin loading of chunks.", | ||||
|           "enum": [false, "anonymous", "use-credentials"] | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue