From 1419a665b0385cb1230d613f4505340787bd782a Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 12 Jun 2024 18:48:35 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9C=88=EB=8F=84=EC=9A=B0=EC=97=90?= =?UTF-8?q?=EC=84=9C=20/=20=EC=9E=91=EB=8F=99=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateBuildConfig.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/scripts/generateBuildConfig.ts b/packages/scripts/generateBuildConfig.ts index 73fd7e5f..2144e117 100644 --- a/packages/scripts/generateBuildConfig.ts +++ b/packages/scripts/generateBuildConfig.ts @@ -31,9 +31,10 @@ const getFilteredComponentFiles = async (directoryPath: string) => { }; const createPaths = (type: "entryFile" | "exports", file: string) => { - const componentDirName = file.split("/")[0] ?? ""; - const componentName = file.split("/")[1]?.slice(0, -4) ?? ""; - const defaultComponent = file.endsWith("index.tsx"); + const parsedPath = path.parse(file); + const componentDirName = parsedPath.dir.split(path.sep)[0] ?? ""; + const componentName = parsedPath.name; + const defaultComponent = componentName === "index"; const typesPath = `./dist/components/${componentDirName}/${defaultComponent ? "index" : componentName}.d.ts`; const importPath = `./dist/${defaultComponent ? componentDirName : componentName}.js`;