File tree Expand file tree Collapse file tree 4 files changed +613
-1
lines changed
Expand file tree Collapse file tree 4 files changed +613
-1
lines changed Original file line number Diff line number Diff line change 1515 "devDependencies" : {
1616 "@types/node" : " ^24" ,
1717 "typescript" : " *" ,
18- "vite" : " *"
18+ "vite" : " *" ,
19+ "vite-plugin-dts" : " ^4.5.4"
1920 }
2021}
Original file line number Diff line number Diff line change 11import { resolve } from 'node:path' ;
22import { existsSync } from 'node:fs' ;
33import type { InlineConfig } from 'vite' ;
4+ import dts from 'vite-plugin-dts' ;
45
56function resolveEntry ( cwd : string ) : string {
67 const tsEntry = resolve ( cwd , 'src' , 'index.ts' ) ;
@@ -14,6 +15,12 @@ export function createViteProdConfig(): InlineConfig {
1415 const cwd = process . cwd ( ) ;
1516
1617 return {
18+ plugins : [
19+ dts ( {
20+ insertTypesEntry : true ,
21+ exclude : [ '**/*.spec.ts' , '**/*.test.ts' ] ,
22+ } ) ,
23+ ] ,
1724 build : {
1825 lib : {
1926 entry : resolveEntry ( cwd ) ,
@@ -23,6 +30,9 @@ export function createViteProdConfig(): InlineConfig {
2330 outDir : resolve ( cwd , 'dist' ) ,
2431 sourcemap : true ,
2532 minify : 'esbuild' ,
33+ rollupOptions : {
34+ external : [ / \. s p e c \. t s $ / , / \. t e s t \. t s $ / ] ,
35+ } ,
2636 } ,
2737 } ;
2838}
Original file line number Diff line number Diff line change 66 "type" : " module" ,
77 "main" : " ./dist/index.cjs" ,
88 "module" : " ./dist/index.js" ,
9+ "types" : " ./dist/index.d.ts" ,
910 "exports" : {
1011 "." : {
12+ "types" : " ./dist/index.d.ts" ,
1113 "import" : " ./dist/index.js" ,
1214 "require" : " ./dist/index.cjs"
1315 },
1416 "./operators" : {
17+ "types" : " ./dist/operators.d.ts" ,
1518 "import" : " ./dist/operators.js" ,
1619 "require" : " ./dist/operators.cjs"
1720 }
You can’t perform that action at this time.
0 commit comments