代码拉取完成,页面将自动刷新
/// <reference types="vitest" />
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import { resolve } from 'path'
import DefineOptions from 'unplugin-vue-define-options/vite'
// import Components from 'unplugin-vue-components/vite'
const path = require("path");
const config = defineConfig({
plugins: [vue(), vueJsx(),
// @ts-ignore
// Components({
// // 指定组件位置,默认是src/components
// dirs: ["src/components"],
// extensions: ["vue"],
// deep: true,
// // 配置文件生成位置
// dts: "types/components.d.ts",
// }),
DefineOptions()
],
target: "es2015",
alias: {
"@": resolve(__dirname, 'src'), // 路径别名
},
build: {
outDir: path.resolve(__dirname, "./dist"),
lib: {
entry: path.resolve(__dirname, "./src/index.js"),
name: "HaloEDesign",
},
rollupOptions: {
context: "globalThis",
preserveEntrySignatures: "strict",
external: ["vue"],
output: [
{
format: "umd",
exports: "named",
sourcemap: false,
entryFileNames: "haloe.min.js",
chunkFileNames: "[name].js",
assetFileNames: "[name].[ext]",
namespaceToStringTag: true,
inlineDynamicImports: false,
manualChunks: undefined,
globals: { vue: "Vue" },
},
{
format: "es",
exports: "named",
sourcemap: false,
entryFileNames: "haloe.min.esm.js",
chunkFileNames: "[name].js",
assetFileNames: "[name].[ext]",
namespaceToStringTag: true,
inlineDynamicImports: false,
manualChunks: undefined,
globals: { vue: "Vue" },
},
{
format: "es",
exports: "named",
sourcemap: false,
// 配置打包根目录
dir: 'dist/es',
preserveModulesRoot: 'src',
entryFileNames: '[name].js',
preserveModules: true,
chunkFileNames: "[name].js",
assetFileNames: "[name].[ext]",
namespaceToStringTag: true,
inlineDynamicImports: false,
manualChunks: undefined,
globals: { vue: "Vue" },
},
{
format: 'cjs',
entryFileNames: '[name].js',
preserveModules: true,
dir: 'dist/lib',
preserveModulesRoot: 'src',
exports: "named",
sourcemap: false,
// 配置打包根目录
chunkFileNames: "[name].js",
assetFileNames: "[name].[ext]",
namespaceToStringTag: true,
inlineDynamicImports: false,
manualChunks: undefined,
globals: { vue: "Vue" },
}
],
},
},
resolve: {
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
},
css: {
preprocessorOptions: {
less:{
charset: false,
additionalData: `@use "${path.resolve(__dirname, 'src/styles/index.less')}"`
}
}
},
define: {
'process.env': { ...process.env }
},
test: {
// 模拟dom环境
environment: "happy-dom",
coverage: {
// 覆盖率提供者
provider: "istanbul",
reporter: ["text", "json", "html"],
// 设置覆盖文件夹
reportsDirectory: "./coverage",
// 检查每个文件的阈值
perFile: true,
// 设置代码覆盖率阈值
lines: 75,
functions: 75,
branches: 75,
statements: 75,
},
// open: true,
// ui:true,
include: ["./src/components/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
},
});
export default config;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。