Files
2026-05-27 23:47:53 +01:00

68 lines
2.3 KiB
TypeScript

import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
export default defineConfig({
root: __dirname,
cacheDir: "../../../node_modules/.vite/packages/hash",
plugins: [
dts({
entryRoot: "src",
tsconfigPath: "./tsconfig.lib.json",
insertTypesEntry: true,
}),
],
build: {
outDir: "./dist",
emptyOutDir: true,
reportCompressedSize: true,
sourcemap: true,
lib: {
entry: {
index: "src/index.ts",
"hash/sha2/sha2": "src/hash/sha2/sha2.ts",
"mac/hmac/hmac": "src/mac/hmac/hmac.ts",
"mac/argon2id-password/argon2id-password":
"src/mac/argon2id-password/argon2id-password.ts",
"mac/blake2b-password/blake2b-password":
"src/mac/blake2b-password/blake2b-password.ts",
"kdf/index": "src/kdf/index.ts",
"encoding/hex/hex": "src/encoding/hex/hex.ts",
"encoding/base64/base64": "src/encoding/base64/base64.ts",
"encoding/index": "src/encoding/index.ts",
"errors/index": "src/errors/index.ts",
"primitives/scrypt/scrypt": "src/primitives/scrypt/scrypt.ts",
"primitives/blake2b/blake2b":
"src/primitives/blake2b/blake2b.ts",
},
formats: ["es"],
},
rollupOptions: {
treeshake: true,
output: {
preserveModules: true,
preserveModulesRoot: "src",
entryFileNames: "[name].js",
},
external: [
"@noble/hashes",
"@noble/hashes/sha2",
"@noble/hashes/hmac",
"@noble/hashes/hkdf",
"@noble/hashes/pbkdf2",
"@noble/hashes/argon2",
"@noble/hashes/scrypt",
"@noble/hashes/blake2b",
"@noble/hashes/utils",
"@suaveplan/crypto-utils",
/^@suaveplan\/crypto-utils\//,
"@suaveplan/error",
"@suaveplan/types",
"tslib",
"zod",
/^node:/,
/^@noble\//,
],
},
},
});