From 3a2ec92cde45e7b524543c50e21a27445ef3fb30 Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Sat, 17 Jun 2023 12:21:29 +0200 Subject: [PATCH] Refactor import statements to use absolute paths --- astro/src/layouts/Layout.astro | 2 +- astro/src/pages/index.astro | 4 ++-- astro/src/pages/posts/[id].astro | 8 ++++---- astro/src/utils/payload.ts | 2 +- astro/tsconfig.json | 5 ++++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/astro/src/layouts/Layout.astro b/astro/src/layouts/Layout.astro index 3362db3..839b25d 100644 --- a/astro/src/layouts/Layout.astro +++ b/astro/src/layouts/Layout.astro @@ -1,5 +1,5 @@ --- -import "global.css"; +import "@/global.css"; export interface Props { title: string; } diff --git a/astro/src/pages/index.astro b/astro/src/pages/index.astro index a7bf4ae..4aea832 100644 --- a/astro/src/pages/index.astro +++ b/astro/src/pages/index.astro @@ -1,6 +1,6 @@ --- -import Layout from "src/layouts/Layout.astro"; -import { getPosts } from "src/utils/payload"; +import Layout from "@/layouts/Layout.astro"; +import { getPosts } from "@/utils/payload"; const posts = await getPosts(); --- diff --git a/astro/src/pages/posts/[id].astro b/astro/src/pages/posts/[id].astro index 10469e5..f94af85 100644 --- a/astro/src/pages/posts/[id].astro +++ b/astro/src/pages/posts/[id].astro @@ -1,8 +1,8 @@ --- -import Layout from "src/layouts/Layout.astro"; -import Content from "src/components/Content.astro"; -import type { Post } from "src/types"; -import { getPost, getPosts } from "src/utils/payload"; +import Layout from "@/layouts/Layout.astro"; +import Content from "@/components/Content.astro"; +import type { Post } from "@/types"; +import { getPost, getPosts } from "@/utils/payload"; export async function getStaticPaths() { const posts = await getPosts(); diff --git a/astro/src/utils/payload.ts b/astro/src/utils/payload.ts index 18b1b48..c5b4fe5 100644 --- a/astro/src/utils/payload.ts +++ b/astro/src/utils/payload.ts @@ -1,4 +1,4 @@ -import type { Post } from "src/types"; +import type { Post } from "@/types"; const url = import.meta.env.DEV ? "http://payload:3001" diff --git a/astro/tsconfig.json b/astro/tsconfig.json index c8cce98..2224ceb 100644 --- a/astro/tsconfig.json +++ b/astro/tsconfig.json @@ -2,6 +2,9 @@ "extends": "astro/tsconfigs/strict", "compilerOptions": { "types": ["@astrojs/image/client"], - "baseUrl": "." + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } } }