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

[WIP] Add explicit wasm extension #1059

Closed
wants to merge 1 commit into from
Closed

[WIP] Add explicit wasm extension #1059

wants to merge 1 commit into from

Conversation

pd4d10
Copy link

@pd4d10 pd4d10 commented Nov 29, 2018

For the case that wasm is not specified at webpack resolve.extensions

@pd4d10 pd4d10 changed the title Add explicit wasm extension [WIP] Add explicit wasm extension Nov 29, 2018
@alexcrichton
Copy link
Contributor

Thanks for the PR! Unfortunately though it looks like CI has discovered that we rely on the convention that if you omit the extension it'll find the file via the first extension that matches. The theory is that the actual extension behind that import doesn't matter, and while it could be a wasm file tools like wasm2es6js will replace it with a JS file.

We may be able to fix this directly though with the tests? It seems like this may be worthwhile fixing in the wild!

@Pauan
Copy link
Contributor

Pauan commented Nov 30, 2018

@alexcrichton I think we should fix it to use .wasm, because when ES6 modules are supported natively in browsers it will need the .wasm extension.

That's because when you import something, the browser does not add any extension, it just makes a direct HTTP GET request.

So if you import "/foo", then the browser will make a GET request to /foo. So it will return a 404, since /foo doesn't exist.

That can be fixed by configuring the web server to automatically rewrite /foo requests to /foo.wasm, but we probably shouldn't require everybody to do that.

@alexcrichton
Copy link
Contributor

Indeed and I agree! This doesn't pass CI though and that needs fixing before we can land it.

@alexcrichton
Copy link
Contributor

Ok I'm gonna close this to help clear out our PR list for now, but we can always land this with working tests!

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