Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import.meta error #340

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions bindings/wasm/build/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ const fs = require('fs')

const entryFilePath = path.join(__dirname, '../web/identity_wasm.js')
const entryFile = fs.readFileSync(entryFilePath).toString()
// comment out this code so it works for Webpack
let changedFile = entryFile.replace(
"input = import.meta.url.replace(",
"// input = import.meta.url.replace("
)
let changedFile = entryFile
// Comment out generated code as a workaround for webpack (does not recognise import.meta)
// Regex to avoid hard-coding 'identity_wasm_bg.wasm'
.replace(
/input = new URL\((.*), import\.meta\.url\);/i,
"// input = new URL($1, import.meta.url);"
)
// Rename original init function, because we want to use the name for our own function
.replace(
"async function init(input) {",
Expand Down