diff --git a/posts/go-to-considered-helpful.mdx b/posts/go-to-considered-helpful.mdx
new file mode 100644
index 0000000..76c41c0
--- /dev/null
+++ b/posts/go-to-considered-helpful.mdx
@@ -0,0 +1,74 @@
+---
+title: "Go to Definition in Typescript Monorepos"
+description: How do I get cmd+click to work in monorepos?
+date: "2025-04-06"
+---
+
+This will be a quick guide for how to get "Go to Definition" working in typescript monorepos instead of the `*.d.ts` files created by the build step. Colin McDonell wrote [a great walkthrough](https://colinhacks.com/essays/live-types-typescript-monorepo) of the different approaches to solving this problem, along with all of the tradeoffs. For this post, we'll just walk through how to use the recommended solution: "customConditions".
+
+## Configuring exports in package.json
+
+First, you'll want to specify the typescript file that acts as the entrypoint for each of your exports.
+
+```json
+"exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "my-internal": "./src/main.ts",
+ "types": "./dist/main.d.ts",
+ "default": "./dist/main.js"
+ },
+},
+```
+
+In this case, I have chosen the custom condition of `my-internal`, but this could be almost anything (stay away from import, require, types, default, etc.).
+
+If you have other exports, add the ts file to those too.
+
+```json
+"exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "my-internal": "./src/main.ts",
+ "types": "./dist/main.d.ts",
+ "default": "./dist/main.js"
+ },
+ "./other": {
+ "my-internal": "./src/other.ts",
+ "types": "./dist/other.d.ts",
+ "default": "./dist/other.js"
+ }
+},
+```
+
+## Configuring the tsconfig.json
+
+Use the custom condition in all of your monorepos tsconfig's. In this case, it is helpful if all your tsconfigs extend a single base config.
+
+```json
+{
+ "compilerOptions": {
+ "customConditions": ["my-internal"]
+ }
+}
+```
+
+## In case you use vite
+
+In your `vite.config.ts`:
+
+```ts
+export default {
+ resolve: {
+ conditions: ["my-internal"],
+ },
+};
+```
+
+## A simple example and farewell
+
+https://github.com/TanStack/query/pull/9042
+
+Implementing this for [waku.gg](https://waku.gg) was quite simple, it just has many exports. Here is [the example PR for this setup](https://github.com/wakujs/waku/pull/1359).
+
+Hopefully you find this helpful and hopefully more monorepos have working "go to definition"!
diff --git a/src/api/rss.xml.ts b/src/api/rss.xml.ts
index 95c657f..25358cb 100644
--- a/src/api/rss.xml.ts
+++ b/src/api/rss.xml.ts
@@ -74,7 +74,9 @@ export const GET = async () => {
pubDate: new Date(Date.UTC(year, month - 1, day)).toUTCString(),
});
}
-
+ items.sort((a, b) => {
+ return new Date(b.pubDate).getTime() - new Date(a.pubDate).getTime();
+ });
const rssFeed = generateRSSFeed(items);
return new Response(rssFeed, {
headers: {
diff --git a/src/page-components/layout.tsx b/src/page-components/layout.tsx
index ef77f46..eff9944 100644
--- a/src/page-components/layout.tsx
+++ b/src/page-components/layout.tsx
@@ -9,7 +9,6 @@ import { PostHogProvider } from "../components/analytics";
type RootLayoutProps = { children: ReactNode };
export async function RootLayout({ children }: RootLayoutProps) {
- console.log("ENV", process.env.NODE_ENV);
return (
--
2.51.2
From d16c9367607dbe6842bf57aaa185c58adc0acda8 Mon Sep 17 00:00:00 2001
From: Tyler
Date: Wed, 23 Apr 2025 12:46:26 -0700
Subject: [PATCH 2/2] post is ready
---
posts/go-to-considered-helpful.mdx | 22 ++++++++++++++--------
src/page-components/post.tsx | 5 ++++-
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/posts/go-to-considered-helpful.mdx b/posts/go-to-considered-helpful.mdx
index 76c41c0..d24a88c 100644
--- a/posts/go-to-considered-helpful.mdx
+++ b/posts/go-to-considered-helpful.mdx
@@ -1,10 +1,10 @@
---
title: "Go to Definition in Typescript Monorepos"
-description: How do I get cmd+click to work in monorepos?
-date: "2025-04-06"
+description: how to get cmd+click working in monorepos
+date: "2025-04-23"
---
-This will be a quick guide for how to get "Go to Definition" working in typescript monorepos instead of the `*.d.ts` files created by the build step. Colin McDonell wrote [a great walkthrough](https://colinhacks.com/essays/live-types-typescript-monorepo) of the different approaches to solving this problem, along with all of the tradeoffs. For this post, we'll just walk through how to use the recommended solution: "customConditions".
+This will be a quick guide for how to get "Go to Definition" working in typescript monorepos instead of the `*.d.ts` files created by the build step. Colin McDonnell wrote [a great walkthrough](https://colinhacks.com/essays/live-types-typescript-monorepo) of the different approaches to solving this problem, along with all of the tradeoffs. For this post, we'll just talk about how to use the recommended solution: "customConditions".
## Configuring exports in package.json
@@ -23,7 +23,7 @@ First, you'll want to specify the typescript file that acts as the entrypoint fo
In this case, I have chosen the custom condition of `my-internal`, but this could be almost anything (stay away from import, require, types, default, etc.).
-If you have other exports, add the ts file to those too.
+If you have other exports, add the ts file to those too. It's important that the `my-internal` condition is the first one listed, otherwise it will not be used.
```json
"exports": {
@@ -62,13 +62,19 @@ export default {
resolve: {
conditions: ["my-internal"],
},
+ // this part is for vite 6 support
+ environments: {
+ ssr: {
+ resolve: {
+ conditions: ["my-internal"],
+ },
+ },
+ },
};
```
## A simple example and farewell
-https://github.com/TanStack/query/pull/9042
-
-Implementing this for [waku.gg](https://waku.gg) was quite simple, it just has many exports. Here is [the example PR for this setup](https://github.com/wakujs/waku/pull/1359).
+Here is an example PR where we moved the tanstack/query monorepo from the tsconfig paths technique, over to the customCondition approach: [tanstack/query#9042](https://github.com/TanStack/query/pull/9042)
-Hopefully you find this helpful and hopefully more monorepos have working "go to definition"!
+Hopefully you find this helpful and hopefully more monorepos support working "go to definition"!
diff --git a/src/page-components/post.tsx b/src/page-components/post.tsx
index 20f4539..033fde8 100644
--- a/src/page-components/post.tsx
+++ b/src/page-components/post.tsx
@@ -30,7 +30,10 @@ export async function PostPage({ slug }: BlogArticlePageProps) {
/>