Skip to content

Conversation

joeyrenhuang
Copy link

Encountered a problem when use module federation. fetch wasm failed coz wasm locates different to window.location.origin, so here will get running env before fetch

@zuckschwerdt
Copy link

I encountered the same problem of needing to resolve the wasm file relative to the script url and not the current window.location.

@joeyrenhuang can you rebase to include the latest change (#50)?

@zuckschwerdt
Copy link

I've confirmed this working for my use-case, but it needs to not match @ in getRunningScript() so we don't prepend the function or code. For examples see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack
I.e. apply zuckschwerdt@eead35b

@benjdevries
Copy link

Something like this would be helpful for my team as well. In development, we serve our HTML from a Django server and load our frontend scripts from Vite, so the fetch tries to request the wasm from the backend server instead of Vite. Has there been any progress on this PR? Is this plugin actively maintained?

@benjdevries
Copy link

I was able to solve my team's issue by setting Vite's server.origin setting to the full URL of our Vite server. Now Vite's asset urls are fully qualified urls instead of just the asset path, so fetch can request from the right server.

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

Successfully merging this pull request may close these issues.

3 participants