Skip to content

import declarations may only appear at top level of a module #43

@lukakostic

Description

@lukakostic

Server.ts :

import { serveDirWithTs } from "jsr:@ayame113/ts-serve";
Deno.serve((request) => serveDirWithTs(request));

index.html :

<html>
    <head>
        <script src="Test.ts"></script>
    </head>
    <body></body>
</html>

Test.ts :

import {test} from "./Test2.ts"
console.log(test);

Test2.ts :

export let test=1;

Result:

image
image

Seems typescript imports dont work under Deno with ts-serve.
Seems something is wrapping the Test.ts file and so the import isnt top-level anymore,
but this is not apparent when clicking the error message as it shows the unmodified (correct) code.
Is this an issue with Deno.emit or ts-serve ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions