Closed fuweichin closed 2 years ago
Thanks for reporting!
Error loading (...) any compiled output js
By using official latest UMD template like returnExportsGlobal.js this problem can be solved.
Currently I get over it by modifying js code (the UMD wrapper part), replacing
this
withtypeof self === 'object' ? self : this
.
In fact, the development "unstable" compiler version already includes that modification in the generated JS for a while (https://github.com/kaitai-io/kaitai_struct_compiler/commit/6809f29e1d62ff8aa3036ec23093fdf0515dcd96), but I wasn't quite sure that it was actually needed, so it's really good that you confirm this. I'll make the same change here in the runtime library.
Propblem:
Error loading KaitaiStream.js or any compiled output js as browser module.
Steps to Reproduce:
Expected Result:
No loading error, exported variables can be accessed through the global object.
Actual Result:
Additional Information:
By using official latest UMD template like returnExportsGlobal.js this problem can be solved.
Currently I get over it by modifying js code (the UMD wrapper part), replacing
this
withtypeof self === 'object' ? self : this
.