2022-04-05 10:31:31 +08:00
|
|
|
import { UserConfigExport } from "vite";
|
|
|
|
import vue from "@vitejs/plugin-vue";
|
2022-08-29 16:23:30 +08:00
|
|
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
2022-04-05 10:31:31 +08:00
|
|
|
import { resolve } from "path";
|
|
|
|
|
|
|
|
export default (): UserConfigExport => {
|
|
|
|
return {
|
|
|
|
publicDir: false,
|
|
|
|
resolve: {
|
|
|
|
alias: [
|
|
|
|
{
|
|
|
|
find: "@",
|
|
|
|
replacement: resolve(process.cwd(), "./"),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2022-08-29 16:23:30 +08:00
|
|
|
plugins: [vue(), vueJsx],
|
2022-04-05 10:31:31 +08:00
|
|
|
build: {
|
|
|
|
cssCodeSplit: false,
|
|
|
|
outDir: "umd",
|
|
|
|
emptyOutDir: true,
|
|
|
|
lib: {
|
|
|
|
entry: resolve(process.cwd(), "./src/index.ts"),
|
|
|
|
name: "LayuiVue",
|
|
|
|
formats: ["umd"],
|
|
|
|
fileName: (name) => `index.js`,
|
|
|
|
},
|
2022-06-27 11:07:22 +08:00
|
|
|
terserOptions: {
|
|
|
|
compress: {
|
|
|
|
drop_console: true,
|
|
|
|
drop_debugger: true,
|
|
|
|
pure_funcs: ["console.log"],
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
comments: true,
|
|
|
|
},
|
|
|
|
},
|
2022-04-05 10:31:31 +08:00
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
globals: {
|
|
|
|
vue: "Vue",
|
|
|
|
},
|
|
|
|
assetFileNames: "index.css",
|
|
|
|
},
|
|
|
|
external: ["vue"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|