sindresorhus/file-type

Add support for ES module "require" syntax

JRiggles opened this issue · 2 comments

When trying to include file-types using require syntax

const fileType = require('file-type');

it fails with the following error:

ReferenceError: require is not defined in ES module scope, you can use import instead

I'm working on an existing codebase that uses require, so I can't easily work with

import { fileTypeFromFile } from 'file-type';

Any help / advice is welcome!

Heard, thanks Sindre! I'll see what I can figure out.