File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// @ts -check
22
3- import { readdirSync , renameSync } from 'node:fs'
3+ import { renameSync } from 'node:fs'
44import { defineConfig } from 'vite'
55import { preserveDirectives } from 'rollup-plugin-preserve-directives'
66import { externalizeDeps } from 'vite-plugin-externalize-deps'
@@ -36,15 +36,10 @@ export const tanstackBuildConfig = (options) => {
3636 module : 'commonjs' ,
3737 declarationMap : false ,
3838 } ,
39- afterBuild : ( ) => {
40- const path = 'dist/cjs'
41- readdirSync ( path , { recursive : true } ) . forEach ( ( file ) => {
42- if ( typeof file === 'string' && file . includes ( '.d.ts' ) ) {
43- renameSync (
44- `${ path } /${ file } ` ,
45- `${ path } /${ file . replace ( '.d.ts' , '.d.cts' ) } ` ,
46- )
47- }
39+ afterBuild : ( emittedFiles ) => {
40+ const paths = Array . from ( emittedFiles . keys ( ) )
41+ paths . forEach ( ( path ) => {
42+ renameSync ( path , path . replace ( '.d.ts' , '.d.cts' ) )
4843 } )
4944 } ,
5045 } ) ,
You can’t perform that action at this time.
0 commit comments