fresh icon indicating copy to clipboard operation
fresh copied to clipboard

When changing the source directory, import maps needs to be in the source for the runtime to work

Open ooker777 opened this issue 1 year ago • 2 comments

When changing the source directory, if the import map is still in the root, then this error will happen:

error: Uncaught (in promise) TypeError: Relative import path "typography" not prefixed with / or ./ or ../ and not in import map from "file:///D:/QC%20supplements/Code/Apps/Tr%E1%BA%A5n%20K%E1%BB%B3/Web/tailwind.config.ts"

The runtime still needs the import map in the source directory. However, for the LSP to work, a duplication of it needs to be on the root.

Related bug: https://github.com/denoland/deploy_feedback/issues/590

ooker777 avatar Jan 31 '24 09:01 ooker777

I can only imagine this would be an issue if you're launching the program from within the source directory. If you're launching it like this: deno run -A src/dev.ts then it should be fine. Are you saying that this isn't working?

deer avatar Jan 31 '24 10:01 deer

yes. I'm on root, and the deno.jsonc in root is like this:

"tasks": {
	"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
	"cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
	"manifest": "deno task cli manifest $(pwd)",
	"start": "deno run -A --watch=static/,routes/ './Web/dev.ts'",
	"build": "deno run -A './Web/dev.ts' build",
	"preview": "deno run -A ./Web/main.ts",
	"update": "deno run -A -r https://fresh.deno.dev/update ."
},

I only use tasks, not run the full commands directly

ooker777 avatar Jan 31 '24 14:01 ooker777