Closed iohzrd closed 2 years ago
This is unrelated to Svelte. If a library depends on the Node buffer
library, that will need to be polyfilled (by a bundler plugin) with a browser-compatible implementation.
The browser export for that package (https://unpkg.com/browse/file-type@17.1.1/browser.js) contains references to node:buffer
, which doesn't sound correct to me. There's a discussion on https://github.com/sindresorhus/file-type/issues/502 that I just found about this.
When I import it how the doc suggests.
import { fileTypeFromBuffer } from "file-type";
I get:I've tried importing it like so:
import { fileTypeFromBuffer } from "file-type/index";
But then I get:I tried various solutions related to external dependencies but still couldn't get it to work.