Skip to content
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

fileTypeFromBlob is not exported from index.js #521

Closed
farid-cognosante opened this issue Jan 3, 2022 · 4 comments
Closed

fileTypeFromBlob is not exported from index.js #521

farid-cognosante opened this issue Jan 3, 2022 · 4 comments

Comments

@farid-cognosante
Copy link

According to the docs for versions 17.x.x the fileTypeFromBlob should be exported from main module 'file-type' instead of 'file-type/browser', but looking at index.js and core.js 'fileTypeFromBlob' is not exported.

@sindresorhus
Copy link
Owner

It's only available in the browser:

file-type/package.json

Lines 16 to 17 in e4a809e

"node": "./index.js",
"default": "./browser.js"

@farid-cognosante
Copy link
Author

I tried to import it in my react app like 'import { fileTypeFromBlob } from 'file-type';' but it says:
Attempted import error: 'fileTypeFromBlob' is not exported from 'file-type'.

How should i import this in a react app?

@sindresorhus
Copy link
Owner

How should i import this in a react app?

This is not really the place to ask for support about React or CRA. It sounds like either your build tool does not support export conditions or you have not configured your project correctly.

@tripolskypetr
Copy link

For some unknown reasons that import condition worked in vite-react app

import { fileTypeFromBlob } from "file-type/core";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants