Skip to content

Instantly share code, notes, and snippets.

View AmanuelCh's full-sized avatar
🎯
Learning

Amanuel Chaka AmanuelCh

🎯
Learning
View GitHub Profile
@AmanuelCh
AmanuelCh / import-markdown.md
Created August 19, 2024 22:06
Import markdown files in .tsx file for a vite project

first in your vite-env.d.ts file, put the following line to let typescript treat .md files as a module.

declare module '*.md';

then in your vite.config.ts file put the following code to create a custom plugin which loads .md files and gets the raw content of the .md file

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';