Open jmagan opened 11 months ago
Any update on this?
Edit by maintainers: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Do you have any solution?
No, unfortunately it doesn't work and it seems to work worse with each upgrade.
Same issue
Edit by maintainers: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Running into probably the same issue. repro here It's my own wrapper around a rust library and built with wasm-pack.
Curiously for me running yarn dev works if I include the following next js config
/** @type {import("next").NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: (config, options) => {
config.experiments = {
asyncWebAssembly: true,
syncWebAssembly: true,
layers: true,
}
return config
},
}
module.exports = nextConfig;
However running yarn build fails, (wether or not webpackBuildWorker is force enabled)
[Error: ENOENT: no such file or directory, open '.next/server/static/wasm/9b4bccc7a1e0e263.wasm']
Given the slight difference in presentation I'm not 100% certain it's the same issue, but I'm too certain to open a separate issue.
Edit: nvm I got it working with the suggestion in #53163 to use next/dynamic and useEffect. I got yours somewhat working too and opened a PR against your example. Could not get static exports to work though.
Running into probably the same issue. repro here It's my own wrapper around a rust library and built with wasm-pack.
Curiously for me running yarn dev works if I include the following next js config
/** @type {import("next").NextConfig} */ const nextConfig = { reactStrictMode: true, webpack: (config, options) => { config.experiments = { asyncWebAssembly: true, syncWebAssembly: true, layers: true, } return config }, } module.exports = nextConfig;
However running yarn build fails, (wether or not webpackBuildWorker is force enabled)
[Error: ENOENT: no such file or directory, open '.next/server/static/wasm/9b4bccc7a1e0e263.wasm']
Given the slight difference in presentation I'm not 100% certain it's the same issue, but I'm too certain to open a separate issue.
Edit: nvm I got it working with the suggestion in #53163 to use next/dynamic and useEffect. I got yours somewhat working too and opened a PR against your example. Could not get static exports to work though.
have you any new solution for this case?
have you any new solution for this case?
Just what's in the pull request, iirc the static export is still broken but for my own library it worked so I didn't look further into it.
Currently encountering the same above issue
⨯ Error: ENOENT: no such file or directory, open 'C:\Users\johnn\Projects\hellomesh\.next\server\vendor-chunks\cardano_serialization_lib_bg.wasm'
Has anyone been able to resolve this?
Currently encountering the same above issue
⨯ Error: ENOENT: no such file or directory, open 'C:\Users\johnn\Projects\hellomesh\.next\server\vendor-chunks\cardano_serialization_lib_bg.wasm'
Has anyone been able to resolve this?
I managed to work around this by moving the library imports and functionalities that required web assembly to pages directory. I had to use the pages directory alongside the the app directory.
Has anyone able to find a way to resolve this?
Link to the code that reproduces this issue or a replay of the bug
https://github.com/jmagan/minimal-wasm-next-app-router-problem
To Reproduce
I was using the library @emurgo/cardano-serialization-lib-nodejs with the page directory. I tried to update my project to App Router and when I perform the following steps, I'm getting an error:
yarn
andyarn dev
Current vs. Expected behavior
This error is thrown:
The name of the missing file is strange because it's supposed to be hashed and in this case, we've got:
.next/server/chunks/cardano_serialization_lib_bg.wasm
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router
Additional context
The problem would be that Webpack isn't detecting correctly the wasm dependency.
The
package.json
of the library @emurgo/cardano-serialization-lib-nodejs is:And this is the file structure:
It seems that they used a tool called
wasm-bidgen
for compilling wasm from rust to javascript. This issue might affect other javascript packages compiled with the same tool.