-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Include .wasm files in output trace #32612
Comments
Are you using Can you share the steps to reproduce? |
Hi @styfle, I have a somewhat minimal branch that's failing. Perhaps it helps you debug, or actually point me in the right direction. https://github.com/icyjoseph/next-battlesnake/tree/with-wasm and this is the file doing the import https://github.com/icyJoseph/next-battlesnake/blob/with-wasm/src/pages/api/wasm/index.js This branch works fine locally, in both development and production builds, however I face the same issue as @sam3d, when publishing to Vercel. I thought of publishing my
However when I push to vercel, going to the Note that there are tweaks to the Thanks! |
ESM imports require a file extension. Did you forget to add |
@styfle Nope, the
Where the wasm file is required in the JS files, it is imported as you say:
So it's not the extension, it is that it is not reachable when deployed to Vercel. |
Can you link to the relevant source code? I'm not seeing |
The thing is that the To get around this, I build the wasm files as part of my vercel build command. However, for sake of getting to the bottom of this, I've made a branch where the wasm files and all of the JS/TS used as glue are present. This link https://github.com/icyJoseph/next-battlesnake/tree/with-wasm-in-git/snake-rs/pkg , points to a branch where the wasm output are included. I checked if this branch works on Vercel, but unfortunately, I get the same error when trying to reach for that endpoint: 2021-12-02T13:05:54.600Z 319b1dfc-0c40-49ca-96cc-f1f4a998da2e ERROR [Error: ENOENT: no such file or directory, open '/var/task/.next/server/chunks/817.wasm'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/var/task/.next/server/chunks/817.wasm'
} It does work locally on development and production mode though. |
It seems to find the wasm file just fine with nft.
It sounds like the issue is Next.js, cc @ijjk |
yep same issue. workaround mentioned here. // next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack(config, { isServer }) {
if (isServer) {
config.output.webassemblyModuleFilename = './../static/wasm/[modulehash].wasm';
} else {
config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm';
}
config.experiments = { asyncWebAssembly: true };
config.optimization.moduleIds = 'named';
return config;
},
};
module.exports = nextConfig; you can check out my repo. building and deploying fine on vercel. |
Thanks @always-maap! I tried your workaround and it fixed |
Currently it is not possible to import
.wasm
files through webpack on serverless functions and have them stay present in the resulting serverless build, it marks the file as having not been foundThe text was updated successfully, but these errors were encountered: