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
The web assembly module seems to be missing from the package #831
Comments
This looks like it's some artifact of the bundler you are using, can you post a minimal reproduction of the issue somewhere? |
Ya sure, here are the steps to reproduce the bug
Also I will be more than happy, if I could contribute to the project, really interested in CRDTs Thanks |
Could you put up a repo somewhere with the example you describe above? (I know it's straightforward but the less scope there is for me to misunderstand you the better). |
Here is the example repo: https://github.com/SubhoYadav/automerge-example |
Hmm, I see the problem. I had a crack at solving this by enabling the webassembly support in webpack but I run into other problems then. I'll try and have more of a look when I'm back from holidays. For reference there's some useful stuff here: vercel/next.js#29362 |
Thank you very much |
Is this issue solved? |
I'm running into this as well, trying to port a functioning app from vanilla React to Next.js. I've put up a simple repro here: Output:
// next.config.mjs
const nextConfig = {
webpack: function (config, options) {
config.experiments = { asyncWebAssembly: true, layers: true }
return config
},
} I get the same error whether or not the |
When I run
I came across this comment which suggests that this is intended behavior:
Following the proposed code, I was able to get this appalling monstrosity to run: 'use client'
import { useEffect, useState } from 'react'
export default function PageComponent() {
const [message, setMessage] = useState<string | undefined>(undefined)
useEffect(() => {
import('@automerge/automerge').then(({ next: A }) => {
const foo = A.from({ message: 'Hello, world!' })
setMessage(foo.message)
})
}, [])
return <p>{message ?? 'Loading...'}</p>
} I don't understand the whole "wasm has to be async" thing -- obviously, I can't be jumping through all those hoops every time I want to use Automerge, and somehow Vite manages to bundle Automerge's wasm with no issues. I suppose I could just abandon Next.js, but it is far and away the most widely used website framework for React, so I don't think Automerge can just write it off: So ... I'm not sure where that leaves us. |
The text was updated successfully, but these errors were encountered: