Deno: Cannot run file without extension (.ts or .js)

Created on 14 May 2020  路  5Comments  路  Source: denoland/deno

So I have structure of app like this

index.ts
package.json

package.json

worked

{
  "scripts": {
    "test": "deno run index.ts"
  }
}

not working

{
  "scripts": {
    "test": "deno run index.ts"
  }
}

I am not sure that whether or not deno will support execute script without extension name in the future.

Most helpful comment

  1. package.json is part of Node.js stack, not Deno.
  2. Deno doesn't support imports without the extension name.
import { x } from "./test.ts"; // works
import { x } from "./test"; // won't

All 5 comments

  1. package.json is part of Node.js stack, not Deno.
  2. Deno doesn't support imports without the extension name.
import { x } from "./test.ts"; // works
import { x } from "./test"; // won't

I am not sure that whether or not deno will support execute script without extension name in the future.

It won't, or it would already. Duplicate of #2506.

(off-topic: I think this should be in the list of FAQ)

should it be somewhere in documentation? I think many JS developers have the same concern.

@davidnguyen179 Technically is more directed towards Node users, JS users are aware of this

A common asked question section would be cool!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xueqingxiao picture xueqingxiao  路  3Comments

metakeule picture metakeule  路  3Comments

ry picture ry  路  3Comments

kyeotic picture kyeotic  路  3Comments

doutchnugget picture doutchnugget  路  3Comments