deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

Uncaught SyntaxError: The requested module 'https://deno.land/[email protected]/http/file_server.ts' does not provide an export named 'ServeDirOptions'

Open BrunoBernardino opened this issue 2 years ago • 1 comments

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/[email protected]/http/file_server.ts' does not provide an export named 'ServeDirOptions'
    at https://deno.land/x/[email protected]/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

BrunoBernardino avatar Jul 30 '22 10:07 BrunoBernardino

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

import { ServeDirOptions } from "https://deno.land/[email protected]/http/file_server.ts";
export { type ServeDirOptions };
import { ServeDirOptions } from "https://deno.land/[email protected]/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/[email protected]/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.

ayame113 avatar Jul 30 '22 14:07 ayame113