-
Notifications
You must be signed in to change notification settings - Fork 85
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
Cannot init wasmer #447
Comments
If you are using Express JS, use the static module: const _static = express.static(.....)
app.use('/your/path/to/static/files', _static, function(req, res, next) {...... This will automatically handle the content-type headers. If you are using another server, make sure you add:
http header. For ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type |
Hmm I'm not sure I understand. I'm not using a backend. I'm just following this tutorial and the issue happens on the imported init function. What is the init function fetching behind the scenes? |
@jonathanhuang13 the example you are showing using vite which spins up a server behind the scenes. If you search online you can find examples like: // vite.config.js
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
{
name: 'wasm-content-type',
configureServer(server) {
server.middlewares.use((req, res, next) => {
if (req.url.endsWith('.wasm')) {
res.setHeader('Content-Type', 'application/wasm');
}
next();
});
},
},
],
}); |
Okay, I looked into this a little more and I don't think that's the root issue. When I run When I run |
If it doesn not resolve corectly on the dev server it would have sent 404 on the Network tab, not a MIME type error. For some reason dev server send the wrong content-type. |
Okay I found a solution to the issue. Looks like vite's optimizations are causing issues when packages import using
|
Awesome, thanks for the tip |
I'll just paste here the entire
|
I'm getting an error when I run:
The error is:
See repro here: https://github.com/jonathanhuang13/wasmer-error-repro
The text was updated successfully, but these errors were encountered: