Updatd config

This commit is contained in:
Sambo Chea 2022-05-17 08:45:48 +07:00
parent d2838808b8
commit 9be02019de
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
2 changed files with 10 additions and 7 deletions

View File

@ -46,7 +46,7 @@
"eslint-plugin-react": "^7.29.4", "eslint-plugin-react": "^7.29.4",
"typescript": "^4.6.3", "typescript": "^4.6.3",
"vite": "^2.9.9", "vite": "^2.9.9",
"vite-plugin-dts": "^1.1.1", "vite-plugin-dts": "^1.1.1"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [

View File

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