mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Fix feature detection of TextEncoder too
It took me an embarrassingly long time to debug this issue that "I already fixed"...
This commit is contained in:
parent
c4b52d0bf6
commit
38c123a157
@ -642,8 +642,9 @@ impl<'a> Context<'a> {
|
||||
"));
|
||||
} else if !self.config.browser {
|
||||
self.globals.push_str(&format!("
|
||||
if (typeof window === 'undefined')
|
||||
var TextEncoder = require('util').TextEncoder;
|
||||
const TextEncoder = typeof window === 'object' && window.TextEncoder
|
||||
? window.TextEncoder
|
||||
: require('util').TextEncoder;
|
||||
"));
|
||||
}
|
||||
self.globals.push_str(&format!("
|
||||
|
Loading…
x
Reference in New Issue
Block a user