Not able to use the library as a browser module because of "path" dependency
I am trying to import this library as a module in the browser. There is a require("path") dependency that is preventing it from being used as a browser module.
Any solutions to this problem.
Hmm, the require("path") looks like something that is either part of WABT's glue code (note that this issue tracker is part of an automated buildbot that is not adding own code), or part of the glue code generated by Emscripten.
So, I checked with rollup and webpack. Both cannot get the library as such. Is there any way that can be done differently? Or are there any examples where it is used as a npm module instead of importing directly on the <script> tags
Last time I checked it worked just fine as an npm module via require("wabt"), but bundling it may require shimming node's path module apparently. I know that webpack can do this with config options, either stubbing the module out (not sure if that'll work, depends on what wabt does with it I guess) or providing an alternative implementation that works in the browser.
For rollup it sayd requires$$0 not found. I am assuming it must be due to the reliance of require in the browser. Now the UMD module works perfectly fine using window.WabtModule (try importing <script src="wabt.js"></script>).
I tried it with parcel and its the only bundler that seems to work with this module as per my configurations. This is an emscripten issue perhaps.
v1.0.16 works for me, v1.0.17, not.