Closed Shazam72 closed 2 months ago
"module": "CommonJS",
This is your problem.
From the readme:
This package is an ESM package. Your project needs to be ESM too. Read more.
Then the problem lies in TS. There is a probability it's converting the import()
statement to a require()
Thanks @sindresorhus
Seems like file-type is not working well or to be exact can't be found in a Typescript environment. My config is bad is working pretty well with the other libraries in my initial project so i guess file-type is the problem here. I isolated it in a separate project to see if the same problem occur again and it does. This is the error I get:
The steps to reproduce are simple. Here is my tree:
in
src/server.ts
:package.json
:my basic
tsconfig.json
for this test project:Note: I ran this same code in pure Javascript, no Typescript support and it work perfectly fine so maybe my config is at fault but i'm not good enough to see it :)