Cannot import the module
zlayine opened this issue · 2 comments
zlayine commented
Hello,
I'm trying to use this library and when i try to import it i get this issue
here is the code i use
import { fileTypeFromFile } from 'file-type';
export default async function nameTest(file) {
const type = await fileTypeFromFile(file);
console.log(type);
}
Does anyone know what causing this issue
sindresorhus commented
That method is only available on Node.js. You must ensure your bundler has the correct config.
cloudymeatball commented
In your tsconfig, you need
{
"module: "node16",
"moduleResolution": "node16"
}
or other node settings as specified on the typescript documentation