Closed wojtekmaj closed 11 months ago
Thanks for the report!
Hm, I'm getting a somewhat different error, but yes, json seems like it doesn't work at the moment.
$ node ./dist/esm/bin.mjs x.ts
file:///Users/isaacs/dev/tapjs/tsimp/package.json:2
"name": "tsimp",
^
SyntaxError: Unexpected token ':'
Do you have "resolveJsonModule": true, in your tsconfig? This might be the reason we're getting different errors.
I did, but maybe it's "type": "module"
in package.json, or different ts versions?
Whatever the case, it was easily fixed :)
Oh! No, it's that your json happened to be valid JS, and mine failed to parse as JS.
So it's the same failure, just different data.
I tried replacing ts-node with tsimp in a Node.js server project.
Upon running
node --import=tsimp/import src/index.js
, I was met with the following error:This obviously works when using ts-node.
I have also tried using new
with
instead ofassert
, but this didn't do the trick either.tsconfig.json
: