DeprecationWarning: No "main" or "exports" field defined in the package.json for @wasm-audio-decoders\common\
rotemdan opened this issue · 0 comments
rotemdan commented
This message appears twice whenever I import mpg123-decoder
:
DeprecationWarning: No "main" or "exports" field defined in the package.json for [...]\node_modules\@wasm-audio-decoders\common\ resolving the main entry point "index.js", imported from [...]\node_modules\mpg123-decoder\src\MPEGDecoder.js.
Default "index" lookups for the main are deprecated for ES modules.
(Use `node --trace-deprecation ...` to show where the warning was created)
Here's how I import:
import { MPEGDecoder } from 'mpg123-decoder';
I fixed it by adding:
"main": "index.js",
to @wasm-audio-decoders\common\package.json
Another approach could use the exports
field instead but I'm not very familiar with it.
(I'm using Node v18.5.0
)