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

yoga-wasm-web versus webpack #28

Open
starpit opened this issue Apr 25, 2023 · 1 comment
Open

yoga-wasm-web versus webpack #28

starpit opened this issue Apr 25, 2023 · 1 comment

Comments

@starpit
Copy link

starpit commented Apr 25, 2023

hello there, thanks for the great module. we are trying to integrate this into a webpack build. webpack isn't particularly happy with this module's use of import.meta.url -- it interprets this to be the location at build time, which, for webpack, is not going to be the same as the location at runtime.

have you given any thoughts to this problem? we tried a few things, such as import("./yoga.wasm"), and thus relying on webpack 5's direct support for webpack modules. but this kind of change will require some deeper modifications...

thanks!

@starpit
Copy link
Author

starpit commented Apr 25, 2023

update: this is what i finally got working:

  1. use the encoded-uint8array-loader via a webpack rule, but just specifically for yoga.wasm (because other wasm uses in our application work fine with normal webpack 5 schemes)

  2. use a hacked version of node.js that does the following:

import initYoga from "./index.js";
import * as bytes from "./yoga.wasm";
const Yoga = await initYoga(bytes.buffer);
export * from "./yoga/javascript/src_js/generated/YGEnums.js";
export default Yoga;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant