Skip to content

Commit

Permalink
fix: cts
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Mar 16, 2024
1 parent 42254da commit 676753e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"postcss-nested": "6.0.1",
"prettier": "3.2.5",
"react": "18.2.0",
"rollup-plugin-preserve-directives": "0.4.0",
"tailwindcss": "3.4.1",
"tslib": "2.6.2",
"typescript": "5.4.2",
Expand Down
22 changes: 18 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { readFileSync } from 'fs'
import { readFileSync, writeFileSync } from 'fs'
import { resolve } from 'path'
import react from '@vitejs/plugin-react'
import { preserveDirectives } from 'rollup-plugin-preserve-directives'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'

Expand All @@ -16,7 +17,11 @@ export default defineConfig({
plugins: [
react(),
dts({
rollupTypes: true,
// rollupTypes: true,
beforeWriteFile: (filePath, content) => {
writeFileSync(filePath.replace('.d.ts', '.d.cts'), content)
return { filePath, content }
},
}),
],
resolve: {
Expand All @@ -41,6 +46,7 @@ export default defineConfig({
'react/jsx-runtime',
...Object.keys(globals),
],
plugins: [preserveDirectives({})],
},
},
})

0 comments on commit 676753e

Please sign in to comment.