Closed d-sphinx closed 1 year ago
Yes there is:
https://github.com/Borewit/strtok3/blob/91791f8f2ef80f905bdc0bc1088fd96ff2076ae9/package.json#L42
Problem is that your environment lacks proper ESM support, duplicate of #1217
Yes there is:
https://github.com/Borewit/strtok3/blob/91791f8f2ef80f905bdc0bc1088fd96ff2076ae9/package.json#L42
Problem is that your environment lacks proper ESM support, duplicate of #1217
How do I fix it? My node is v14.20.1 (latest in 14 branch) - is this causes a problem?
Node version should be ^14.13.1 || >=16.0.0"
, so that is fine.
Tests are passing against the latest Node v14:
https://github.com/Borewit/music-metadata/blob/master/.github/workflows/nodejs-ci.yml#L50
Maybe upgrade your TypeScript dev dependencies, seems on that level as it complaining about typings.
I think the issue for most build tools (including the typescript compiler in the default configuration), is that the import should be to strtok3/lib/core
adding this to the compilerOptions of the tsconfig works:
"paths": {
"strtok3/core": ["./node_modules/strtok3/lib/core"]
}
or use moduleResolution: "node16"
in the same place
The problem with the latter method is that is incompatible with many web packers (like Parcel or WebPack). In this case, you should use https://github.com/Borewit/music-metadata-browser instead.
Thanks for sharing your experience @bradleat, on the long run I want to merge music-metadata-browser with (to) music-metadata, as ESM allows different import path for node.js and browser.
Please also raise this shortcomings at the web bundlers not supporting this. ESM is the official standard format after-all.
"music-metadata": "^8.1.0"
[{ "resource": "/c:/_WORK/link_metadata/node_modules/music-metadata/lib/apev2/APEv2Token.d.ts", "owner": "typescript", "code": "2307", "severity": 8, "message": "Cannot find module 'strtok3/core' or its corresponding type declarations.", "source": "ts", "startLineNumber": 2, "startColumn": 27, "endLineNumber": 2, "endColumn": 41 }]
APEv2Token.d.ts tries to import { IGetToken } from 'strtok3/core';
There is no 'core' file or dir in node_modules/strtok3