denoland / denoland/deploy_feedback
Error: The deployment failed: Relative import path "$fresh/server.ts" not prefixed with / or ./ or ../
- Dominant language
- No language data
- Stars
- 79
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
### Discussed in https://github.com/denoland/fresh/discussions/2246
Originally posted by **ooker777** January 13, 2024
When deploying I get this error:
```
Deploying... (100.0%)
Error: The deployment failed: Relative import path "$fresh/server.ts" not prefixed with / or ./ or ../
```
[A person who had the same error on their machine](https://stackoverflow.com/a/74748824/3416774) solves this by adding this to the import map:
```
"deno.importMap": "./import_map.json"
```
This doesn't work on my case. In my understanding this shouldn't be an issue at all. Do you know why is that?
# Background
My fresh project is under some sub-folder from the root. The structure is like this:
```.
├── .github
├── .git
└── deno.json/
└── 1/
└── Web/
├── main.ts
└── dev.ts
```
# `deno.json`
```json
{
"lock": false,
"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/ './1/Web/dev.ts'",
"build": "deno run -A './1/Web/dev.ts' build",
"preview": "deno run -A ./1/Web/main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
...
"exclude": [
"**/_fresh/*"
],
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.6.1/",
"preact": "https://esm.sh/preact@10.19.2",
"preact/": "https://esm.sh/preact@10.19.2/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.1",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.0",
"tailwindcss": "npm:tailwindcss@3.3.5",
"tailwindcss/": "npm:/tailwindcss@3.3.5/",
"tailwindcss/plugin": "npm:/tailwindcss@3.3.5/plugin.js",
"$std/": "https://deno.land/std@0.208.0/",
"daisyui": "npm:daisyui@4.4.19"
},
...
```
# `.github/workflows/deploy.yaml`
```yaml
name: Deploy
on:
push:
branches: [main]
pull_request:
branches: main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Build step
run: "deno task build" # 📝 Update the build command(s) if necessary
- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "tranky" # 📝 Update the deploy project name if necessary
entrypoint: "./1/Web/main.ts" # 📝 Update the entrypoint if necessary
```
(Also asked on [Stack Overflow](https://stackoverflow.com/q/77814003/3416774))
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with deno.json and .github/workflows/deploy.yaml, then inspect the deployctl entrypoint ./1/Web/main.ts and the $fresh/server.ts import used by the Fresh project. Reproduce the deployment from the nested 1/Web directory and determine why the import map is not applied; done means the workflow deploys successfully without the relative-import error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- deno, github-actions, yaml
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100