@tritium-research/react-component
Version:
A react component library based on material-ui, build for tritium internal usecases.
54 lines (52 loc) • 1.25 kB
text/typescript
import { defineConfig } from "vite";
import { resolve } from "path";
import react from "@vitejs/plugin-react";
import { fileURLToPath } from "node:url";
import dts from "vite-plugin-dts";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
dts({
tsconfigPath: "tsconfig.json",
}),
],
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, "src/index.ts"),
name: "Tritium React Component",
// the proper extensions will be added
fileName: "index",
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [
"react",
"ReactDOM",
"@faker-js/faker",
fileURLToPath(
new URL(
"src/stories",
import.meta.url
)
),
fileURLToPath(
new URL(
".storybook",
import.meta.url
)
),
/node_modules/,
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: "React",
},
},
},
},
});