Merge pull request #117 from markandrus/fix-require-from-different-directory

Call fs.readFileSync with __dirname
This commit is contained in:
Alex Crichton 2018-04-10 08:58:55 -05:00 committed by GitHub
commit db15a898cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,7 +148,8 @@ impl Bindgen {
}
shim.push_str(&format!("
const bytes = require('fs').readFileSync('{}');
const join = require('path').join;
const bytes = require('fs').readFileSync(join(__dirname, '{}'));
const wasmModule = new WebAssembly.Module(bytes);
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
module.exports = wasmInstance.exports;