From edfaef2c7524d198ed1b6bcea2c7bf4781467957 Mon Sep 17 00:00:00 2001
From: p-sw <shinwoo.park@psw.kr>
Date: Tue, 11 Jun 2024 15:43:56 +0900
Subject: [PATCH] feat: add lib alias in vite config and tsconfig

The commit includes a new alias @pswui-lib in both the `vite.config.ts` and `tsconfig.json` files. This change facilitates a more straightforward and concise import of files located in the 'lib' directory.
---
 packages/react/tsconfig.json  |  5 +++--
 packages/react/vite.config.ts | 26 +++++++++++++++++---------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json
index 66e7e24..d6afc07 100644
--- a/packages/react/tsconfig.json
+++ b/packages/react/tsconfig.json
@@ -24,9 +24,10 @@
     "baseUrl": "./",
     "paths": {
       "@components/*": ["components/*"],
-      "@/*": ["src/*"]
+      "@/*": ["src/*"],
+      "@pswui-lib/*": ["lib/*"]
     }
   },
-  "include": ["components", "src"],
+  "include": ["components", "src", "lib"],
   "references": [{ "path": "./tsconfig.node.json" }]
 }
diff --git a/packages/react/vite.config.ts b/packages/react/vite.config.ts
index f32c365..c031216 100644
--- a/packages/react/vite.config.ts
+++ b/packages/react/vite.config.ts
@@ -1,17 +1,24 @@
 import { defineConfig } from "vite";
 import react from "@vitejs/plugin-react";
 import tailwindcss from "tailwindcss";
-import mdx from '@mdx-js/rollup';
-import { resolve } from 'node:path';
+import mdx from "@mdx-js/rollup";
+import { resolve } from "node:path";
 import remarkGfm from "remark-gfm";
-import withSlug from "rehype-slug"
+import withSlug from "rehype-slug";
 import withToc from "@stefanprobst/rehype-extract-toc";
 import withTocExport from "@stefanprobst/rehype-extract-toc/mdx";
-import dynamicImport from 'vite-plugin-dynamic-import'
+import dynamicImport from "vite-plugin-dynamic-import";
 
 // https://vitejs.dev/config/
 export default defineConfig({
-  plugins: [react(), mdx({ rehypePlugins: [withSlug, withToc, withTocExport], remarkPlugins: [remarkGfm] }), dynamicImport()],
+  plugins: [
+    react(),
+    mdx({
+      rehypePlugins: [withSlug, withToc, withTocExport],
+      remarkPlugins: [remarkGfm],
+    }),
+    dynamicImport(),
+  ],
   css: {
     postcss: {
       plugins: [tailwindcss()],
@@ -19,8 +26,9 @@ export default defineConfig({
   },
   resolve: {
     alias: {
-      '@components': resolve(__dirname, './components'),
-      '@': resolve(__dirname, './src'),
-    }
-  }
+      "@components": resolve(__dirname, "./components"),
+      "@": resolve(__dirname, "./src"),
+      "@pswui-lib": resolve(__dirname, "./lib"),
+    },
+  },
 });