layui/package/component/script/build.all.ts
就眠儀式 f0c850985d 📝: update
2022-06-27 11:07:22 +08:00

49 lines
1.0 KiB
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`,
},
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
pure_funcs: ["console.log"],
},
output: {
comments: true,
},
},
rollupOptions: {
output: {
globals: {
vue: "Vue",
},
assetFileNames: "index.css",
},
external: ["vue"],
},
},
};
};