-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Cannot use parseFile
if the TypeScript compiler moduleResolution
is set to bundler
#2370
Cannot use parseFile
if the TypeScript compiler moduleResolution
is set to bundler
#2370
Comments
Thanks for creating a reproduction repository @lowvisiondave ! The problem you are facing is because the
It certainly does, it is right here: Line 40 in c824bb9
But you are not importing this file, you are importing the compiled version of core.ts, and that does indeed not have The reason your conditional export is not working, is most likely related to the fact you are using, What I fear neither works is this (almost literally taken from TypeScript documentation) {
"compilerOptions": {
"....": "",
"moduleResolution": "bundler",
"customConditions": ["node"],
"....": "",
}
} Identical issue on file-type: sindresorhus/file-type#738 I will investigate possible workarounds, to be continued.... |
Adding the |
parseFile
is missing in TypeScript typesparseFile
if the TypeScript compiler moduleResolution
is set to bundler
Interesting, I've never come across that before. Thanks for the explanation! It might be worth adding a note to the documentation, since I experienced this on a fresh Next.js project and it was discouraging me from using your library. |
Also having this problem. Can this be made to just work out of the box? I've never encountered this issue with any other library before. |
The problem is in your TypeScript compiler is not including Node specific functionality, as it believes by setting bundler as your module-resolution, you are not going to need that. What do you want me to do about that?
And which of those libraries have Node.js specific functionality, and nicely integrate browser platforms? Raise the issue where it comes from, at Next.js (suggest to include Node condition by default) or for this issue: microsoft/TypeScript#61357. |
Is there an existing issue for this?
music-metadata version
11.0.0
Current Behavior
TypeScript throw an error when doing the following:
Because
node_modules/music-metadata/lib/core.d.ts
does not include a type forparseFile
.Adding
// @ts-expect-error
allows the application to build successfully, so it seems to just a types issue.Reproduction repository
Expected Behavior
I would expect the types to match the functions being exported.
Attached audio sample?
The text was updated successfully, but these errors were encountered: