Refactor imports in Astro project

This commit is contained in:
Max Schmidt 2023-06-17 10:50:48 +02:00
parent e4ccd21a23
commit 08df56c679
6 changed files with 12 additions and 11 deletions

View File

@ -1,7 +1,7 @@
--- ---
import { Image } from "@astrojs/image/components"; import { Image } from "@astrojs/image/components";
import { getContentArray } from "../utils/helpers"; import { getContentArray } from "src/utils/helpers";
import { getImageSrc } from "../utils/payload"; import { getImageSrc } from "src/utils/payload";
const { content } = Astro.props; const { content } = Astro.props;
const contentArray = getContentArray(content); const contentArray = getContentArray(content);
--- ---

View File

@ -1,5 +1,5 @@
--- ---
import "../global.css"; import "global.css";
export interface Props { export interface Props {
title: string; title: string;
} }

View File

@ -1,6 +1,6 @@
--- ---
import Layout from "../layouts/Layout.astro"; import Layout from "src/layouts/Layout.astro";
import { getPosts } from "../utils/payload"; import { getPosts } from "src/utils/payload";
const posts = await getPosts(); const posts = await getPosts();
--- ---

View File

@ -1,8 +1,8 @@
--- ---
import Layout from "../../layouts/Layout.astro"; import Layout from "src/layouts/Layout.astro";
import Content from "../../components/Content.astro"; import Content from "src/components/Content.astro";
import type { Post } from "../../types"; import type { Post } from "src/types";
import { getPost, getPosts } from "../../utils/payload"; import { getPost, getPosts } from "src/utils/payload";
export async function getStaticPaths() { export async function getStaticPaths() {
const posts = await getPosts(); const posts = await getPosts();

View File

@ -1,4 +1,4 @@
import type { Post } from "../types"; import type { Post } from "src/types";
const url = import.meta.env.DEV const url = import.meta.env.DEV
? "http://payload:3001" ? "http://payload:3001"

View File

@ -1,6 +1,7 @@
{ {
"extends": "astro/tsconfigs/strict", "extends": "astro/tsconfigs/strict",
"compilerOptions": { "compilerOptions": {
"types": ["@astrojs/image/client"] "types": ["@astrojs/image/client"],
"baseUrl": "."
} }
} }