chore: build shared components as a lib

This commit is contained in:
Florian Duros 2025-10-02 17:44:31 +02:00
parent 4b323f2bd3
commit 832d7ed43f
No known key found for this signature in database
GPG Key ID: A5BBB4041B493F15
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,17 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
export * from "./audio/AudioPlayerView";
export * from "./audio/Clock";
export * from "./audio/PlayPauseButton";
export * from "./audio/SeekBar";
export * from "./avatar/AvatarWithDetails";
export * from "./event-tiles/TextualEventView";
export * from "./message-body/MediaBody";
export * from "./pill-input/Pill";
export * from "./pill-input/PillInput";
export * from "./rich-list/RichItem";

41
vite.config.js Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
const __dirname = dirname(fileURLToPath(import.meta.url));
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, "src/shared-components/index.ts"),
name: "Element Web Shared Components",
// the proper extensions will be added
fileName: "element-web-shared-components",
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["react"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: "react",
},
},
},
},
resolve: {
alias: {
// Alias used by i18n.tsx
$webapp: resolve(__dirname, "webapp"),
},
},
});