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

Difficult to understand the error message when the extension is missing #8024

Closed
taiju opened this issue Oct 19, 2020 · 4 comments · Fixed by #8114
Closed

Difficult to understand the error message when the extension is missing #8024

taiju opened this issue Oct 19, 2020 · 4 comments · Fixed by #8114
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@taiju
Copy link

taiju commented Oct 19, 2020

I found it difficult to understand the error message when the script file was created without the extension.

To Reproduce

deno --version
deno 1.4.6
v8 8.7.220.3
typescript 4.0.3
rm -rf ~/.cache/deno/*
cat <<EOT > mod
import * as log from "https://deno.land/std/log/mod.ts";

log.info("hello");
EOT
deno run mod

Result

thread 'main' panicked at 'Cached source file doesn't exist', cli/global_state.rs:222:8
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If there is no import statement, it will not be reproduced. (So it was even more confusing.)

It would be nice if we could read the error messages to see that the files specified in the deno run must have an extension.

@grosto
Copy link
Contributor

grosto commented Oct 20, 2020

I think it makes sense to throw if some module has no/unsupported media type in the dependency graph.

I can work on this if maintainers agree with this behaviour.

@kitsonk
Copy link
Contributor

kitsonk commented Oct 20, 2020

@grosto this area of code is going under a major refactor (see: #7225 and #7996). I plan to try to address this already as part of #7996.

Local files without extensions should actually work and be treated as JavaScript, so I am not totally sure why this is currently failing.

@kitsonk kitsonk added bug Something isn't working correctly cli related to cli/ dir labels Oct 20, 2020
@kitsonk kitsonk self-assigned this Oct 20, 2020
@grosto
Copy link
Contributor

grosto commented Oct 20, 2020

Local files without extensions should actually work and be treated as JavaScript, so I am not totally sure why this is currently failing.

I think it's failing because ModuleGraphLoader does not extract and fetch dependencies for files other than js, jsx, ts, tsx.

@kitsonk
Copy link
Contributor

kitsonk commented Oct 21, 2020

This is partially fixed in #7996 but I will need to revisit it to make sure we can support it fully. There are challenges with tsc with extension-less root modules that need to be addressed.

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 cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants