48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { defineConfig } from 'vite';
 | |
| import { dirname } from 'node:path';
 | |
| import * as path from 'path';
 | |
| import { fileURLToPath } from 'node:url';
 | |
| import react from '@vitejs/plugin-react-swc';
 | |
| import { peerDependencies } from './package.json';
 | |
| import dts from 'vite-plugin-dts';
 | |
| 
 | |
| const __dirname = dirname(fileURLToPath(import.meta.url));
 | |
| 
 | |
| // https://vite.dev/config/
 | |
| export default defineConfig({
 | |
|   plugins: [
 | |
|     react(),
 | |
|     dts({
 | |
|       outDir: 'dist',
 | |
|       entryRoot: 'src',
 | |
|       staticImport: true,
 | |
|       copyDtsFiles: true,
 | |
|       rollupTypes: true,
 | |
|       tsconfigPath: './tsconfig.app.json',
 | |
|       compilerOptions: {
 | |
|         noEmit: false,
 | |
|         emitDeclarationOnly: true,
 | |
|       },
 | |
|     }),
 | |
|  
 | |
|   ],
 | |
|   publicDir: 'public',
 | |
|   build: {
 | |
|     minify: true,
 | |
|     sourcemap: true,
 | |
|     assetsDir: 'assets',
 | |
|     lib: {
 | |
|       entry: path.resolve(__dirname, 'src/lib.ts'),
 | |
|       name: 'lib',
 | |
|       formats: ['es', 'cjs'],
 | |
|       fileName: (format) => `lib.${format}.js`,
 | |
|     },
 | |
|     emptyOutDir: true,
 | |
|     outDir: 'dist',
 | |
| 
 | |
|     rollupOptions: {
 | |
|       external: Object.keys(peerDependencies),
 | |
|     },
 | |
|   },
 | |
| });
 |