-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Import error on startup when a Fresh project is a workspace member #24622
Comments
This seems to occur when a dependency of a workspace member refers to something in the import map of said member. In this case fresh is expected to resolve the |
is this the same issue as when a
seems to work for not island components |
I have the same issue with preact. Trying to make a fresh app a workspace member (it’s been a subfolder) |
issue still happening |
yes issue still happens. |
+1
|
having exact same issue when using workspace and deno. ward. |
I got it to work by adding the dependencies of the fresh app into my root deno.jsonc // root deno config
{
"workspace": [
"./projects/fresh-app"
],
"tasks": {
"dev:fresh-app": "cd projects/fresh-app && deno run -A --node-modules-dir start"
},
"nodeModulesDir": "auto",
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.7.3/",
"preact": "https://esm.sh/preact@10.22.0",
"preact/": "https://esm.sh/preact@10.22.0/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
"$std/": "https://deno.land/std@0.216.0/"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact",
"lib": [
"deno.window",
"dom"
],
"strict": true
}
} // project deno config
{
"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/ dev.ts",
"build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"exclude": [
"**/_fresh/*"
],
"fmt": {
"lineWidth": 120,
"singleQuote": true
},
"imports": {
}
}
-> deno task dev:fresh-app If you get // deno-lint-ignore no-unused-vars
import * as React from "preact/compat"; found here -> denoland/fresh#785 (comment) |
I came across this and it took me several days to resolve. If I had just followed directions it would have not been so much. Here are plain as day instructions to get it up and running Move all of your imports from your fresh deno.json to your workspace json. add the following into your entrypoint:
|
If a Fresh project is a workspace member, an import error occurs on startup. Here's how to reproduce it:
Here's the error message:
The text was updated successfully, but these errors were encountered: