From 84d9f437fa997df7943032c0d6b649aab6873e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Guid=C3=A9e?= Date: Wed, 13 Mar 2024 00:09:35 -0400 Subject: [PATCH] fix(components): make build working with yarn workspaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Quentin Guidée --- packages/components/.storybook/main.ts | 14 ++++++++++---- packages/components/tsconfig.json | 3 ++- packages/components/vite.config.ts | 7 +++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/components/.storybook/main.ts b/packages/components/.storybook/main.ts index 00bb790a..155d61dc 100644 --- a/packages/components/.storybook/main.ts +++ b/packages/components/.storybook/main.ts @@ -1,4 +1,5 @@ import type { StorybookConfig } from "@storybook/react-vite"; +import * as path from "path"; const config: StorybookConfig = { stories: [ @@ -11,10 +12,15 @@ const config: StorybookConfig = { "@storybook/addon-onboarding", "@storybook/addon-interactions", ], - framework: { - name: "@storybook/react-vite", - options: {}, - }, + framework: path.resolve( + require.resolve("@storybook/react-vite"), + "..", + ) as any, + // This doesn't work with Yarn workspaces, so we use the above workaround instead. + // framework: { + // name: "@storybook/react-vite", + // options: {}, + // }, docs: { autodocs: "tag", defaultName: "Documentation", diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index 2d5dca81..efc119ae 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -23,7 +23,8 @@ "esModuleInterop": true }, "include": [ - "lib" + "lib", + "index.ts" ], "references": [ { diff --git a/packages/components/vite.config.ts b/packages/components/vite.config.ts index 851fdbc1..f5be834b 100644 --- a/packages/components/vite.config.ts +++ b/packages/components/vite.config.ts @@ -1,5 +1,5 @@ -import {defineConfig} from "vite"; -import {resolve} from "path"; +import { defineConfig } from "vite"; +import { resolve } from "path"; import react from "@vitejs/plugin-react"; import dts from "vite-plugin-dts"; @@ -9,13 +9,12 @@ export default defineConfig({ react(), dts({ insertTypesEntry: true, - rollupTypes: true, exclude: ["**/*.stories.tsx", "**/*.test.tsx"], }), ], build: { lib: { - entry: resolve(__dirname, "lib/index.ts"), + entry: resolve(__dirname, "index.ts"), name: "vertex-components", formats: ["es", "umd"], fileName: (format) => `vertex-components.${format}.js`,