cubetiq-muui/vite.config.ts

34 lines
802 B
TypeScript
Raw Normal View History

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