Open V3rt3Xk3 opened 1 week ago
I get this without the addition to type: module in package json of the bio-parsers module:
(node:21648) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ...
to show where the warning was created)
D:\Repos\t1l3s_sequence_format_converter\bio-parsers-api\node_modules\@teselagen\bio-parsers\index.js:29084
export {
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at cjsLoader (node:internal/modules/esm/translators:356:17)
at ModuleWrap.
Node.js v20.11.1
@V3rt3Xk3 would you like to make a pull request with your suggested code changes?
Thanks!
@tnrich
Hi, thank you for your work!!!
I was unable to import the genbank to json parser. In the github repositorythe code is correct, but the npm package lacks the type setting.
Fixed packages.json, now i can import the
import {genbankToJson} from '@teselagen/bio-parsers';
{ "type": "module", "name": "@teselagen/bio-parsers", "version": "0.4.22", "dependencies": { "@teselagen/sequence-utils": "0.3.27", "@teselagen/range-utils": "0.3.7", "@gmod/gff": "^1.2.1", "buffer": "^6.0.3", "bufferpack": "^0.0.6", "color": "^4.2.3", "fast-xml-parser": "^4.2.5", "fflate": "^0.8.0", "lodash-es": "^4.17.21", "string_decoder": "^1.3.0", "validate.io-nonnegative-integer-array": "^1.0.1" }, "license": "MIT" }
Original packages.json (missing type declaration) { "name": "@teselagen/bio-parsers", "version": "0.4.22", "dependencies": { "@teselagen/sequence-utils": "0.3.27", "@teselagen/range-utils": "0.3.7", "@gmod/gff": "^1.2.1", "buffer": "^6.0.3", "bufferpack": "^0.0.6", "color": "^4.2.3", "fast-xml-parser": "^4.2.5", "fflate": "^0.8.0", "lodash-es": "^4.17.21", "string_decoder": "^1.3.0", "validate.io-nonnegative-integer-array": "^1.0.1" }, "license": "MIT" }
The "type": "module" is missing. I am new to typescript but without this I was not able to use your code on backend. (Node20, typescript)
My import was always complaining about syntax errors regarding an unexpected token: export. Also I have installed the package with this npm command: npm install -S @teselagen/bio-parsers
Also if it like this by design then please let me know and I do a fork :), thanks