Skip to content

Commit

Permalink
chore: example for using Vite by api
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Mar 20, 2024
1 parent 7c10782 commit 5e63117
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions examples/ts/api-build.ts
@@ -0,0 +1,7 @@
import { fileURLToPath } from 'node:url'

import { build } from 'vite'

const rootDir = fileURLToPath(new URL('.', import.meta.url))

await build({ root: rootDir })
3 changes: 2 additions & 1 deletion examples/ts/package.json
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"private": true,
"scripts": {
"build": "DEBUG=\"vite-plugin-dts:bundle\" vite build"
"build": "DEBUG=\"vite-plugin-dts:bundle\" vite build",
"build:api": "tsx ./api-build.ts"
},
"types": "dist/ts-test.d.ts",
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions examples/ts/vite.config.ts
Expand Up @@ -6,6 +6,8 @@ import dts from '../../src'
emptyDir(resolve(__dirname, 'dist'))
emptyDir(resolve(__dirname, 'types'))

console.log('a')

export default defineConfig({
resolve: {
alias: {
Expand Down

0 comments on commit 5e63117

Please sign in to comment.