Closed devastion closed 7 months ago
We don't have enough detail to create a reproducible sample of your issue, but it sounds like your tsconfig.json
needs some additional configuration.
You will need to explicitly add a path to resolve your index.ts
. For example:
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@a/fn/*": ["./a/fn/*"],
+ "@a/fn": ["./a/fn/index"]
}
},
}
If that doesn't work for you, can you please provide us with a sample project?
Hi, @smcenlly! You can see example here. I am importing from a directory too (relative path), but quokka doesn't pick up automatically index. It may be issue with ts-node or something else. I am not sure.
EDIT: I am exporting in this case, but even when use import * as varName from "./plugins"
doesn't work.
ERR_UNSUPPORTED_DIR_IMPORT <rootDir>/src/plugins <rootDir>/src/index.js
This is actually node.js
expected behavior when you use ESM (i.e. "type": "module"
in your package.json
).
You will need to configure Quokka to run node with an option to allow importing directories with the experimental-specifier-resolution
setting via Quokka configuration:
{
"env": {
"params": {
"runner": "--experimental-specifier-resolution=node"
}
}
}
Thanks! It resolved my problem.
Issue description or question
Importing directory,, doesn't catch
index.ts
. Example - we have@a
is ts path alias.Quokka.js Console Output
Code editor version Visual Studio Code v1.88.1
OS name and version MacOS Sonoma 14.4.1