keystonejs / keystonejs/keystone
does not support relative path support for typescript baseUrl or Paths
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 1.3k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 19
Description
* Add `tsconfig.json` option for `baseUrl` or `paths` option, for example `"baseUrl": "./src"` or `"paths": {"@/*", "./src/*"}`
* import anything using the aliases
it breaks with module not found error
Expected to work without issue
I see that the esbuild custom plugin to blame here which excludes anything not starting with ` .` as external.
I have came across this page: https://janessagarrow.com/blog/typescript-and-esbuild/ which has example using `package.json` dependencies as external.
I have tried it and that works with `@manypkg/find-root`. I had to get the package.json dependencies and mark them external rather than the custom plugin. I prefer using `find-root` instead of just getting `cwd+package.json` in `getEsbuildConfig`, this enable use case where keystone cli is used from within another package.
if interested, I can add example here.
Also found some example to achieve this as https://github.com/evanw/esbuild/issues/619#issuecomment-751769812
Contributor guide
Research direction
Start by tracing the custom esbuild plugin and getEsbuildConfig, then review how the Keystone CLI determines the package root. Reproduce the failure with TypeScript baseUrl or paths aliases and compare it with the working @manypkg/find-root approach. Done means aliased imports resolve without a module-not-found error when the CLI runs from another package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100