cubetiq-muui/vite.config.ts
2022-05-17 09:05:18 +07:00

34 lines
802 B
TypeScript

import * as path from "node:path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";
// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, "src/lib/index.ts"),
name: "MUUI",
formats: ["es", "umd"],
fileName: (format) => `muui.${format}.js`,
},
rollupOptions: {
// externalize deps that shouldn't be bundled
external: ["react", "react-dom"],
output: {
// Provide global variables to use in the UMD build for externalized deps
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
plugins: [
react(),
dts({
insertTypesEntry: true,
}),
],
});