Created
July 22, 2024 13:27
-
-
Save janpauldahlke/de294a0bb3178564cb627c6dc9435b89 to your computer and use it in GitHub Desktop.
consume ts only module from jsr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isOdd } from "@hail-discordia/is-odd-ts"; | |
export function main() { | |
console.log(isOdd(2)) | |
} | |
main() | |
// i used this here, where one can see the source. maybe the error is occuring in me publishing it wrong? | |
// tried `tsc main.ts` which gives me a `main.js` but `node main.js` results in this error: | |
// | |
```shell | |
Node.js v18.18.2 | |
➜ consume-ts-is-odd node main.js | |
file:///Users/hagbard/dev/consume-ts-is-odd/main.js:2 | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
^ | |
ReferenceError: exports is not defined in ES module scope | |
This file is being treated as an ES module because it has a '.js' file extension and '/Users/hagbard/dev/consume-ts-is-odd/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension. | |
at file:///Users/jdahlke/dev/consume-ts-is-odd/main.js:2:23 | |
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "consume-ts-is-odd", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"type": "module", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"@hail-discordia/is-odd-ts": "npm:@jsr/hail-discordia__is-odd-ts@^0.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment