UNPKG

@spark-ui/internal-utils

Version:

package for sharing reusable code and resources across the codebase

35 lines (31 loc) 904 B
import { readFileSync } from 'node:fs' import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' import terser from '@rollup/plugin-terser' import browserslistToEsbuild from 'browserslist-to-esbuild' import { defineConfig } from 'vite' import dts from 'vite-plugin-dts' const __dirname = dirname(fileURLToPath(import.meta.url)) const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8')) as { peerDependencies?: Record<string, string> } const peerDeps = Object.keys(pkg.peerDependencies || {}) export default defineConfig({ build: { target: browserslistToEsbuild(), lib: { entry: 'src/index.ts', formats: ['es', 'cjs'], fileName: 'index', }, rolldownOptions: { external: ['node:path', 'node:fs', ...peerDeps], plugins: [terser()], }, }, plugins: [ dts({ entryRoot: './src', }), ], })