-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to transform tsconfig paths (aliases)? #217
Comments
It is, and i've used them for making access to my own private types more convenient pre-publish 🎉 |
@NullVoxPopuli could you please elaborate on that? Do you transform the paths in the published .d.ts files at all? |
Naw, I was mistaken -- I had confused an old work project which had an incorrect TS setup. I tried to replicate what I was thinking here: https://stackblitz.com/edit/stackblitz-starters-ifwkx1 but it does indeed need transformation, as declaration building doesn't compile away the alias. So, I found that using your suggestion of Here is the result export type { Foo } from '#types'; Note that I can't vouch for how stable this tool is over time, or how it works with changes in ts-versions. |
@NullVoxPopuli thank you! |
yea, it's stuff like that for why I'd probably stick with regular relative imports, or try to get all the tools (tsc, rollup, etc) to support native aliases, aka: import subpaths https://nodejs.org/api/packages.html#subpath-imports |
Hi!
In a TypeScript-enabled v2 addon, is it possible to use tsconfig paths? Or rather, is it possible to add an option to compile those path aliases into real paths in the
dist
output?Previously, when
rollup-plugin-ts
was the recommendation, any custom paths/aliases worked just fine - I could use @rollup/plugin-alias to rewrite the paths during the build.Now that the build is split into two steps (
js
andtypes
), this is no longer enough. While thejs
step still works with the Rollup plugin, I can't do anything to change the output for thetypes
step. All the.d.ts
results will have incorrect paths, and any TypeScript consumer of my addon won't work, because the type declarations are incorrect.Is it possible to add import path rewriting in the build step? Maybe use something like transform-typescript-paths?
I wasn't quite sure where to post this issue, I feel like it really belongs in Glint, but it's also relevant to what the recommended addon structure here is.
The text was updated successfully, but these errors were encountered: