Skip to content

Commit

Permalink
fix(components): make build working with yarn workspaces
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin Guidée <[email protected]>
  • Loading branch information
quentinguidee committed Mar 13, 2024
1 parent a554116 commit 84d9f43
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 10 additions & 4 deletions packages/components/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { StorybookConfig } from "@storybook/react-vite";
import * as path from "path";

const config: StorybookConfig = {
stories: [
Expand All @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"esModuleInterop": true
},
"include": [
"lib"
"lib",
"index.ts"
],
"references": [
{
Expand Down
7 changes: 3 additions & 4 deletions packages/components/vite.config.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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`,
Expand Down

0 comments on commit 84d9f43

Please sign in to comment.