72 lines
2.4 KiB
TypeScript
72 lines
2.4 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import dts from "vite-plugin-dts";
|
|
|
|
export default defineConfig({
|
|
root: __dirname,
|
|
cacheDir: "../../../node_modules/.vite/packages/testing-dom",
|
|
plugins: [
|
|
dts({
|
|
entryRoot: "src",
|
|
tsconfigPath: "./tsconfig.lib.json",
|
|
insertTypesEntry: true,
|
|
}),
|
|
],
|
|
build: {
|
|
outDir: "./dist",
|
|
emptyOutDir: true,
|
|
reportCompressedSize: true,
|
|
sourcemap: true,
|
|
lib: {
|
|
// Multi-entry so every subpath export in package.json#exports
|
|
// maps to a real emitted file. Modules not imported from the
|
|
// root barrel (polyfills, matchers, config, runner variants)
|
|
// are listed explicitly so Rollup keeps them.
|
|
entry: {
|
|
index: "src/index.ts",
|
|
"setup/polyfills": "src/setup/polyfills.ts",
|
|
"matchers/matchers": "src/matchers/matchers.ts",
|
|
"config/index": "src/config/index.ts",
|
|
"runner/vitest": "src/runner/vitest.ts",
|
|
"runner/bun-test": "src/runner/bun-test.ts",
|
|
"errors/index": "src/errors/index.ts",
|
|
"render/index": "src/render/index.ts",
|
|
"queries/queries": "src/queries/queries.ts",
|
|
"user/setup-user": "src/user/setup-user.ts",
|
|
},
|
|
formats: ["es"],
|
|
},
|
|
rollupOptions: {
|
|
treeshake: true,
|
|
output: {
|
|
preserveModules: true,
|
|
preserveModulesRoot: "src",
|
|
entryFileNames: "[name].js",
|
|
},
|
|
external: [
|
|
"@opentelemetry/api",
|
|
"@testing-library/dom",
|
|
"@testing-library/jest-dom",
|
|
"@testing-library/react",
|
|
"@testing-library/user-event",
|
|
"@vitejs/plugin-react",
|
|
"bun:test",
|
|
"dom-accessibility-api",
|
|
"happy-dom",
|
|
"react",
|
|
"react-dom",
|
|
"react/jsx-runtime",
|
|
"node:fs",
|
|
"node:path",
|
|
"node:url",
|
|
"node:util",
|
|
"node:crypto",
|
|
"tslib",
|
|
"vitest",
|
|
"vitest/config",
|
|
"zod",
|
|
/^node:/,
|
|
],
|
|
},
|
|
},
|
|
});
|