File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -62,15 +62,17 @@ function createCompatibleModuleInBundle(transpiledJs, transpiledWasm) {
62
62
63
63
function createCompatibleModuleOutBundle ( publicPath ) {
64
64
return `
65
- var f=fetch(${ publicPath } ).then(function(response){
66
- return response.arrayBuffer();
67
- }).then(function(binary){
68
- var module = new WebAssembly.Module(binary);
69
- var instance = new WebAssembly.Instance(module, { env: { abort: function() {} } });
70
- return instance.exports;
71
- });
72
- module.exports =f;
73
- ` ;
65
+ function createWebAssemblyModulePromise() {
66
+ var p = WebAssembly.instantiateStreaming(
67
+ fetch(${ publicPath } ),
68
+ { env: { abort: function() {} } }
69
+ ).then(function(module) {
70
+ return module.instance.exports;
71
+ });
72
+ return p;
73
+ }
74
+ module.exports = createWebAssemblyModulePromise;
75
+ ` ;
74
76
}
75
77
function mkDirsSync ( dirname ) {
76
78
if ( fs . existsSync ( dirname ) ) {
You can’t perform that action at this time.
0 commit comments