This question has already been asked here but I wasn’t sure if necroposting was okay here.
I followed the chain of function calls starting from js-ipfs, and found that it calls the
dagBuilder function from ipfs-unixfs-importer which seems to be the point in the call stack where some actual work gets done.
ipfs-unixfs-importer does not seem to be a module that can be compiled for the browser (e.g. it doesn’t exist on a CDN, only the
ipfs-unixfs library exists for browsers, and seems to require manually chunking the file.
In the existing question by @sparkplug0025, someone suggested using GitHub - alanshaw/ipfs-only-hash: #️⃣ Just enough code to calculate the IPFS hash for some data, but that also depends on
ipfs-unixfs-importer and therefore also seems to be incompatible with browsers (the
ipfs-only-hash package isn’t available on a CDN either).