mirror of https://github.com/webpack/webpack.git
				
				
				
			Merge pull request #5807 from STRML/fix/externalModule
Fix #5806, TypeError on ExternalModule hash.update
This commit is contained in:
		
						commit
						15fe297fb1
					
				|  | @ -120,7 +120,7 @@ class ExternalModule extends Module { | |||
| 	updateHash(hash) { | ||||
| 		hash.update(this.type); | ||||
| 		hash.update(JSON.stringify(this.request)); | ||||
| 		hash.update(JSON.stringify(this.optional)); | ||||
| 		hash.update(JSON.stringify(Boolean(this.optional))); | ||||
| 		super.updateHash(hash); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -340,4 +340,32 @@ module.exports = some/request;`; | |||
| 			hashedText.should.containEql("12345678"); | ||||
| 		}); | ||||
| 	}); | ||||
| 
 | ||||
| 	describe("#updateHash without optional", function() { | ||||
| 		let hashedText; | ||||
| 		let hash; | ||||
| 		beforeEach(function() { | ||||
| 			hashedText = ""; | ||||
| 			hash = { | ||||
| 				update: (text) => { | ||||
| 					hashedText += text; | ||||
| 				} | ||||
| 			}; | ||||
| 			// Note no set of `externalModule.optional`, which crashed externals in 3.7.0
 | ||||
| 			externalModule.id = 12345678; | ||||
| 			externalModule.updateHash(hash); | ||||
| 		}); | ||||
| 		it("updates hash with request", function() { | ||||
| 			hashedText.should.containEql("some/request"); | ||||
| 		}); | ||||
| 		it("updates hash with type", function() { | ||||
| 			hashedText.should.containEql("some-type"); | ||||
| 		}); | ||||
| 		it("updates hash with optional flag", function() { | ||||
| 			hashedText.should.containEql("false"); | ||||
| 		}); | ||||
| 		it("updates hash with module id", function() { | ||||
| 			hashedText.should.containEql("12345678"); | ||||
| 		}); | ||||
| 	}); | ||||
| }); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue