denoland / deploy_feedback

For reporting issues with Deno Deploy
https://deno.com/deploy
74 stars 5 forks source link

Uncaught SyntaxError: The requested module 'https://deno.land/std@0.144.0/http/file_server.ts' does not provide an export named 'ServeDirOptions' #252

Open BrunoBernardino opened 2 years ago

BrunoBernardino commented 2 years ago

Hey guys, I'm seeing a very strange error about an export missing in http/file_server.ts in Deno Deploy, which doesn't happen locally or in other deployment environments:

Uncaught SyntaxError: The requested module 'https://deno.land/std@0.144.0/http/file_server.ts' does not provide an export named 'ServeDirOptions'
    at https://deno.land/x/ts_serve@v1.1.0/mod.ts:1:20

I logged it with some more details in https://github.com/ayame113/ts-serve/issues/9 and asked in Discord about it at https://discord.com/channels/684898665143206084/826085979344470037/1002878942362996856

ayame113 commented 2 years ago

The code below works without error on emit from tsc and gives an error on emit from swc.

import { ServeDirOptions } from "https://deno.land/std@0.144.0/http/file_server.ts";
export { type ServeDirOptions };
import { ServeDirOptions } from "https://deno.land/std@0.144.0/http/file_server.ts";
         ^
    at <anonymous> (file:///C:/Users/ayame/work/deno/test/serve.ts:1:10)

I believe the changes made in https://github.com/denoland/deno/pull/15118 exposed this problem.


However, I fixed and released the causative library as follows, so the problem shouldn't exist anymore.

import { type ServeDirOptions } from "https://deno.land/std@0.144.0/http/file_server.ts";
export { type ServeDirOptions };

I'm not sure if this is a swc bug or my code is bad. So I'll leave it to someone else to decide whether to close this issue.