fix(cli): avoid crash on import of invalid module names (#19523)

Fixes https://github.com/denoland/deno/issues/17748
Closes #17770

Co-authored-by: Anton Bershanskiy
<bershanskiy@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
This commit is contained in:
Bartek Iwańczuk 2023-06-15 20:36:33 +02:00 committed by GitHub
parent fa63fd4610
commit 0733943fe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,6 @@
Download http://localhost:4545/npm/registry/ws%3A
FAILED
TypeError: npm package 'ws:' does not exist.
at async file:///[WILDCARD]/dynamic_import_invalid_package_name/main.ts:2:3 {
code: "ERR_MODULE_NOT_FOUND"
}

View file

@ -0,0 +1,6 @@
try {
await import(`npm:${"ws:"}`);
} catch (err) {
console.log("FAILED");
console.log(err);
}