2023-06-05 00:33:43 +01:00
|
|
|
import { defineConfig } from "vitest/config";
|
2023-06-01 02:05:35 +01:00
|
|
|
import { resolve } from "path";
|
|
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
import dts from "vite-plugin-dts";
|
|
|
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [
|
|
|
|
tsconfigPaths(),
|
|
|
|
dts(),
|
|
|
|
nodePolyfills({
|
|
|
|
exclude: ["fs"],
|
2023-07-18 21:06:35 +01:00
|
|
|
globals: {
|
|
|
|
Buffer: false,
|
|
|
|
},
|
2023-06-01 02:05:35 +01:00
|
|
|
protocolImports: true,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@util/": `${resolve(__dirname, "src/util")}/`,
|
|
|
|
"@export/": `${resolve(__dirname, "src/export")}/`,
|
|
|
|
"@file/": `${resolve(__dirname, "src/file")}/`,
|
|
|
|
"@shared": `${resolve(__dirname, "src/shared")}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
build: {
|
2023-06-12 18:43:29 +01:00
|
|
|
minify: false,
|
2023-06-01 02:05:35 +01:00
|
|
|
lib: {
|
|
|
|
entry: [resolve(__dirname, "src/index.ts")],
|
|
|
|
name: "docx",
|
2023-07-18 01:53:56 +01:00
|
|
|
fileName: (d) => {
|
|
|
|
if (d === "umd") {
|
|
|
|
return "index.umd.js";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d === "cjs") {
|
|
|
|
return "index.cjs";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d === "es") {
|
|
|
|
return "index.js";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d === "iife") {
|
|
|
|
return "index.iife.js";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "unknown";
|
|
|
|
},
|
2023-06-01 02:05:35 +01:00
|
|
|
formats: ["iife", "es", "cjs", "umd"],
|
|
|
|
},
|
|
|
|
outDir: resolve(__dirname, "build"),
|
|
|
|
commonjsOptions: {
|
|
|
|
include: [/node_modules/],
|
|
|
|
},
|
|
|
|
},
|
2023-06-07 15:11:47 +01:00
|
|
|
test: {
|
|
|
|
environment: "jsdom",
|
2023-06-12 18:43:29 +01:00
|
|
|
coverage: {
|
2023-06-15 21:15:39 +01:00
|
|
|
provider: "v8",
|
2023-06-12 18:43:29 +01:00
|
|
|
reporter: ["text", "json", "html"],
|
|
|
|
statements: 99.93,
|
|
|
|
branches: 98.85,
|
|
|
|
functions: 100,
|
|
|
|
lines: 99.93,
|
|
|
|
},
|
2023-06-07 15:11:47 +01:00
|
|
|
},
|
2023-06-01 02:05:35 +01:00
|
|
|
});
|