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
feat(remix-dev): add ability to use tsconfig paths
aliases other than ~
#2412
Conversation
Hi @F3n67u, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
@F3n67u thank you for taking the time for this 🙌🏼 |
Just wondering, will this perhaps solve #1405? |
Yes please 🙏🏼 |
@westmark I don't know much background about #1405. This pr will probably solve the following limit which lists in #1405;
|
@F3n67u make sure to unmark the draft status when the PR is ready please. |
Do you know if |
I think no, see this issue dividab/tsconfig-paths#127 |
I generally dislike being able to change what an import path means, but because nested route folders make importing super annoying we added just one alias to the root with Looking at what most people do w/ these import aliases, it's usually just pointing to some root folder anyway: import from "components/button"
import from "~/components/button" I think I could be convinced for the migration use case--but even then, most apps migrating to remix could do a find/replace in probably half an hour to switch to I really don't want to look at a path in a remix app and have no clue what it points to. |
I hear what you're saying @ryanflorence, but I also think there's a strong case for including this behavior in Remix since |
Not to mention that this change will allow NX to fully support Remix(nrwl/nx#8019), unless I'm sadly mistaken. But yeah, I also generally agree with what @ryanflorence is saying. |
@machour test on ci takes forever to run, now it takes 3h+. could you help to take a look at it? |
@F3n67u I tried to cancel it, but something weird is going on with this build.. can you try to nudge it by doing a new commit? |
@ryanflorence Depending on the size of the project, having aliases may come handy for some teams. |
@F3n67u never mind, the build process finally got canceled after my message. I just triggered a new one, hopefully this one won't get stuck |
~
paths
aliases other than ~
@F3n67u I think something is definitely going wrong with the CI when running with this PR changes. |
this is looking great so far @F3n67u, we just need to add support for MDX, remix/packages/remix-dev/compiler/plugins/mdx.ts Lines 19 to 24 in eafad35
|
also strip indents from integration files before writing them to disk Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
tests are failing on dev at the moment which is why they are failing here |
paths
aliases other than ~
paths
aliases other than ~
🤖 Hello there, We just published version Thanks! |
I there, I just tried v1.3.5-pre.1, it works fine, except of a detail: Context: So in a nutshell, all dependencies are declared in the root package.json, but remix commands are declared in the app specific package.json. When I dev or build my application, I have a warning for every dependency that I import, because remix doesn't find them in the app specific package.json
The list is quite OK for now because that's a sandbox project, but I can imagine the list growing a lot for a real world project :) I don't know where I should create an issue for that. is it remix responsibility, nrwl responsibility? |
@npirotte I'm not sure what this have to do with this PR. |
Yes, I'm getting similar errors. I had to roll back to 1.3.4 to continue working. |
@jacargentina would you mind fill a new issue witha reproduction repo? |
@F3n67u I think there is some change on remix related to importing I've commented that import, so the first error is gone, but now I have another one: Maybe I must adapt my code to some change on remix about those .server files ? |
@jacargentina what's inside your tsconfig.json or jsconfig.json? |
My tsconfig.json: {
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"module": "esnext",
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"esModuleInterop": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"resolveJsonModule": true,
"strict": true,
"paths": {
"~/*": ["./app/*"]
},
// Remix takes care of building everything in `remix build`.
"noEmit": true
}
} I've adjuted it like this, and now it is working; I basically removed "module" and added "target" {
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"resolveJsonModule": true,
"target": "ES2019",
"strict": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
// Remix takes care of building everything in `remix build`.
"noEmit": true
}
} |
you also added a |
@F3n67u dividab/tsconfig-paths#199 is now merged. |
@MichaelDeBoey will do it after the new version is published! |
@F3n67u https://github.com/dividab/tsconfig-paths/blob/master/CHANGELOG.md#400---2022-05-02 |
great. I will make a pr later. |
…an `~` (remix-run#2412) Co-authored-by: Jacob Ebey <jacob.ebey@live.com> Co-authored-by: Logan McAnsh <logan@mcan.sh>
Closes: #2298