Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno compile leads to TS errors if root directory is included #27024

Open
irbull opened this issue Nov 23, 2024 · 0 comments · May be fixed by #27032
Open

Deno compile leads to TS errors if root directory is included #27024

irbull opened this issue Nov 23, 2024 · 0 comments · May be fixed by #27032
Labels
bug Something isn't working correctly compile related to the `deno compile` feature

Comments

@irbull
Copy link
Contributor

irbull commented Nov 23, 2024

Version: Deno 2.1.x

If you include the root --include . then the compiled executable fails with syntax errors.

Steps to reproduce

  1. Create a simple TS program
// example.ts
// This is a TypeScript function and its parameter has a type
function tsFunction(param: any) {
    console.log(param);
}

tsFunction("Hello, World!");
  1. compile with the root included: deno compile -A --include . example.ts

Run the resulting binary:

$ ./example
  .error: Uncaught SyntaxError: Unexpected token ':'
    at <anonymous> (file:///var/folders/0v/jhqzvwhx345fsngdr12f6zg00000gn/T/deno-compile-example/fresh-site/symlink_test/example.ts:2:26)

It seems that the runtime tries to execute the TS file as if it were a transpiled JS file, probably because it's included at the root.

@dsherret dsherret added bug Something isn't working correctly compile related to the `deno compile` feature labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly compile related to the `deno compile` feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants