This commit is contained in:
2026-05-16 00:51:11 +08:00
parent 92e4fd11f1
commit 0f23a8f7a0
67 changed files with 153 additions and 384 deletions

View File

@@ -0,0 +1,41 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
export default defineConfig(({ command }) => {
if (command === "serve") {
return {
plugins: [react()],
root: "playground",
};
}
return {
plugins: [react()],
build: {
cssMinify: false,
lib: {
entry: path.resolve(import.meta.dirname, "src/index.ts"),
formats: ["es", "cjs"],
fileName: (format) => `index.${format}.js`,
},
rolldownOptions: {
external: ["react", "react-dom", "react/jsx-runtime"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
emptyOutDir: true,
sourcemap: true,
cssCodeSplit: false,
outDir: "dist",
},
};
});