Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Webpack warning caused by dynamic require
Webpack supports dynamic importing only for some special cases in which it is able to narrow down the set of packages to bundled. In the general case it just produces an empty (Webpack) context plus the warning stating that "the request of a dependency is an expression." Apparently the commit 120a1d7 changed the Javascript generated by wasm-bindgen so that the binding for the `require` became: ``` module.require(getStringFromWasm0(arg0, arg1)) ``` when it used to be: ``` getObject(arg0).require(getStringFromWasm0(arg1, arg2)) ``` In the latter case Webpack did not even realize that this code imported a package and, hence, did not try to bundle it. The new code triggers the bundling and because the dependency is fully dynamic Webpack has problems with it. This commit reverts partially the commit 120a1d7 so that the generated binding obfuscates the `require` call enough to hide it from Webpack again.
- Loading branch information