mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 21:53:57 -05:00
69 lines
1.5 KiB
TypeScript
69 lines
1.5 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { resolve } from "path";
|
|
import removeTestIdAttribute from "rollup-plugin-jsx-remove-attributes";
|
|
import { defineConfig } from "vite";
|
|
import dts from "vite-plugin-dts";
|
|
import { peerDependencies } from "./package.json";
|
|
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
tanstackRouter({
|
|
target: "react",
|
|
autoCodeSplitting: true
|
|
}),
|
|
react(),
|
|
tailwindcss(),
|
|
dts({
|
|
include: ["lib"],
|
|
tsconfigPath: "./tsconfig.lib.json",
|
|
rollupTypes: true,
|
|
insertTypesEntry: true,
|
|
compilerOptions: {
|
|
declarationMap: false
|
|
}
|
|
}),
|
|
removeTestIdAttribute({ usage: "vite" })
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": resolve(__dirname, "src"),
|
|
"$": resolve(__dirname, "lib"),
|
|
"#root": resolve(__dirname)
|
|
}
|
|
},
|
|
build: {
|
|
lib: {
|
|
entry: resolve(__dirname, "lib/index.ts"),
|
|
formats: [ "cjs", "es" ],
|
|
name: "Mattrixwv Component Library"
|
|
},
|
|
rollupOptions: {
|
|
external: [
|
|
"react",
|
|
"react-dom",
|
|
"react/jsx-runtime",
|
|
...Object.keys(peerDependencies).map(dep => dep.toString())
|
|
],
|
|
output: {
|
|
globals: {
|
|
react: "React",
|
|
"react-dom": "ReactDOM"
|
|
},
|
|
manualChunks: undefined
|
|
}
|
|
}
|
|
},
|
|
publicDir: false,
|
|
test: {
|
|
globals: true,
|
|
root: "test",
|
|
environment: "jsdom",
|
|
setupFiles: [ "jest.config.ts" ]
|
|
}
|
|
});
|