-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
40 lines (39 loc) · 1.56 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/// <reference types="vitest" />
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import { peerDependencies } from './package.json'
import path from 'path'
import react from '@vitejs/plugin-react'
export default defineConfig({
build: {
lib: {
entry: './src/index.ts', // Specifies the entry point for building the library.
name: 'vite-react-ts-button', // Sets the name of the generated library.
fileName: (format) => `index.${format}.js`, // Generates the output file name based on the format.
formats: ['cjs', 'es'], // Specifies the output formats (CommonJS and ES modules).
},
rollupOptions: {
external: [...Object.keys(peerDependencies)], // Defines external dependencies for Rollup bundling.
},
sourcemap: true, // Generates source maps for debugging.
emptyOutDir: true, // Clears the output directory before building.
},
plugins: [dts(), react()], // Uses the 'vite-plugin-dts' plugin for generating TypeScript declaration files (d.ts).
test: {
globals: true,
environment: 'jsdom',
setupFiles: './setupTests.ts',
include: ['**/?(*.)test.ts?(x)'],
},
resolve: {
alias: {
'@': path.resolve(__dirname, './'),
'@src': path.resolve(__dirname, './src'),
'@assets': path.resolve(__dirname, './src/assets'),
'@components': path.resolve(__dirname, './src/components'),
'@helpers': path.resolve(__dirname, './src/helpers'),
'@hooks': path.resolve(__dirname, './src/hooks'),
'@interfaces': path.resolve(__dirname, './src/interfaces'),
},
},
})