Hi,
I am trying to use rhino3dm.js on a NextJs/React project.
export default function Home() {
const onClick = useCallback(() => {
rhino3dm().then((Module) => {
const sphere = new Module.Sphere([0, 0, 0], 16);
console.log(`rhino3dm sphere:${sphere.radius}`);
});
}, []);
return (
<div className={styles.container}>
<main>
<h1>Rhino Compute Test</h1>
<button onClick={onClick}> Load rhino3dm</button>
</main>
</div>
);
}
When executing the promise rhino3dm().then()
some problems come along trying to load the wasm file and the next error appear:
rhino3dm.js?6024:9 Uncaught (in promise) RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.
at abort (rhino3dm.js?6024:9:13992)
at getBinary (rhino3dm.js?6024:9:14705)
at eval (rhino3dm.js?6024:9:15077)
I have tried some settings on webpack but non of them had worked so far. Currently this is my current settings on next.config.js
:
const nextConfig = {
reactStrictMode: true,
future: {
webpack5: true,
},
webpack: (config, { dev }) => {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
config.experiments = {
asyncWebAssembly: true,
syncWebAssembly: true,
};
return config;
},
};
module.exports = nextConfig;
I also tried to put the wasm file on my public directory but that did not work either.
To replicate the error, I just created a nextjs project with rhino3dm and the above code in here.
I am unsure what could help me to solve my current error so any help would be very much appreciated.