-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Path aliases in create-t3-app
code
#206
Comments
My proposal for code in
I would like to raise an extra point aswell: in #116 (comment) I've defined a typescript submodule, and I would like to have path aliases there aswell. We should avoid clashes with the ones defined above so I would propose to use the
Some examples with all of the above: // importing from src
import { PKG_ROOT } from "~/consts.ts";
import { buildPkgInstallerMap } from "~/installers/index.ts";
import { getUserPkgManager } from "~/utils/getUserPkgManager.js";
// importing from a subpackage
import { BaseContextTransformOptions } from "~transform/addons/trpc/base-context.js"; |
looks awesome thats literally what i was about to open a PR for |
Path aliases make moving to monorepos quite painful and are generally very opinionated. I think we decided awhile back to not do this for those reasons |
They're talking about path aliases in the CLI code, not the template. |
Im down for including it in the cli code |
I kind of feel like path aliases are the only way that allows the company I work for to actually move to a monorepo - We had imports like ../../... x 8 (poor programming I know) and by refactoring to absolute imports, we could move stuff around without being afraid it will break stuff and then we could move to a monorepo when everything is organized, for example: 'src/components/FilePickers/Unsplash/components/UnsplashPicker' is now ' |
Maybe it should actually be a cli option (but then the next question is what makes something a cli option? Why this and not that etc) |
Sorry if maybe I wasn't clear enough in OP, the intent of this issue is to add path aliases in the code that generates the project, not the code of the project being created. So to clarify: path aliases resulting from this issue would only be noticeable by contributors of this project. |
Great idea, but should we refactor all of cli code using path alias after adding the config? |
Ideally refactor everything too |
Is your feature request related to a problem? Please describe.
We decided that the scaffolded app will not have path aliases here: #85
But it was raised that maybe for the
create-t3-app
code would be worth having a new discussion, as this would only affect contributors and they were not the target of the decisions taken in the original issue.Describe the solution you'd like
Define path aliases in
create-t3-app
so contributors have an easier and consistent way of importing code. In this issue we can propose/discuss what is the path aliases that we want to have, then decide and create a MR from it.Describe alternatives you've considered
Leave imports as they are.
The text was updated successfully, but these errors were encountered: