I'm a complete NextJS / React and Wasm newbie, but I'm having fun learning and building a simple website.
I've added @emurgo/cardano-serialization-lib-browser
as a dep to my NextJS 17 project w/ npm i @emurgo/cardano-serialization-lib-browser
.
When I run in dev mode npm run dev
all is fine, I can use the library and everything looks great.
Unfortunately, when I build the project to deploy it on Vercel, I get the following error:
[Error: ENOENT: no such file or directory, open '/Users/giovanni/Development/workspace/raffles-easystaking/.next/server/static/wasm/35db299fd815ad0d.wasm'] {
type: 'Error',
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/giovanni/Development/workspace/raffles-easystaking/.next/server/static/wasm/35db299fd815ad0d.wasm'
}
This is my package.json
{
"name": "raffles-easystaking",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@emurgo/cardano-serialization-lib-browser": "^10.2.0",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"next": "12.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hot-toast": "^2.2.0"
},
"devDependencies": {
"autoprefixer": "^10.4.7",
"eslint": "8.20.0",
"eslint-config-next": "12.2.2",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.6"
}
}
and this is my next.config
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
webpack: function (config, options) {
config.experiments = { asyncWebAssembly: true, layers: true };
return config;
}
}
module.exports = nextConfig
I also use tailwind, but I don't think that would be the issue.
Any help appreciated.
Thanks!