mirror of https://github.com/webpack/webpack.git
				
				
				
			create Source with Buffers for WASM
This commit is contained in:
		
							parent
							
								
									4947a5ac71
								
							
						
					
					
						commit
						d5ad14813f
					
				|  | @ -385,7 +385,8 @@ class WebAssemblyGenerator extends Generator { | |||
| 		// TODO remove this casts when webpack-sources is fixed
 | ||||
| 		// source() should have return type (string | Buffer)
 | ||||
| 		const sourceAsAny = /** @type {TODO} */ (source); | ||||
| 		let bin = /** @type {ArrayBuffer} */ (sourceAsAny); | ||||
| 		const buf = /** @type {Buffer} */ (sourceAsAny); | ||||
| 		const bin = buf.buffer; | ||||
| 
 | ||||
| 		const usedExports = moduleGraph.getUsedExports(module); | ||||
| 		const initFuncId = t.identifier( | ||||
|  | @ -456,7 +457,9 @@ class WebAssemblyGenerator extends Generator { | |||
| 
 | ||||
| 		const newBin = transform(bin); | ||||
| 
 | ||||
| 		return new RawSource(newBin); | ||||
| 		const newBuf = Buffer.from(newBin); | ||||
| 
 | ||||
| 		return new RawSource(/** @type {TODO} */ (newBuf)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue