From acd01eb2b41e37a480943f79cfa28fc220c4baca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 5 Sep 2024 07:25:56 +0100 Subject: feat: Add a hint on error about 'Relative import path ... not prefixed with ...' (#25430) Running a file like: ``` import "@std/dotenv/load"; ``` Without a mapping in `imports` field of `deno.json` or `dependencies` of `package.json` will now error out with a hint: ``` error: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../ hint: Try running `deno add @std/dotenv/load` at [WILDCARD]bare_specifier_without_import/main.ts:1:8 ``` Closes https://github.com/denoland/deno/issues/24699 --------- Co-authored-by: David Sherret --- tests/testdata/run/node_prefix_missing/main.ts.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/testdata/run/node_prefix_missing') diff --git a/tests/testdata/run/node_prefix_missing/main.ts.out b/tests/testdata/run/node_prefix_missing/main.ts.out index fd19ed55f..48b4e37e2 100644 --- a/tests/testdata/run/node_prefix_missing/main.ts.out +++ b/tests/testdata/run/node_prefix_missing/main.ts.out @@ -1,3 +1,3 @@ error: Relative import path "fs" not prefixed with / or ./ or ../ -If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs"). + hint: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs"). at file:///[WILDCARD]/main.ts:1:16 -- cgit v1.2.3