layui/package/component/script/build.all.ts
2022-04-05 10:31:31 +08:00

39 lines
806 B
TypeScript

import { UserConfigExport } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
export default (): UserConfigExport => {
return {
publicDir: false,
resolve: {
alias: [
{
find: "@",
replacement: resolve(process.cwd(), "./"),
},
],
},
plugins: [vue()],
build: {
cssCodeSplit: false,
outDir: "lib",
emptyOutDir: true,
lib: {
entry: resolve(process.cwd(), "./src/index.ts"),
name: "layui-vue",
formats: ["es"],
fileName: (name) => `index.js`,
},
rollupOptions: {
output: {
globals: {
vue: "Vue",
},
assetFileNames: "index.css",
},
external: ["vue"],
},
},
};
};