Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
fix: type generation without vite-dts (#166)
Browse files Browse the repository at this point in the history
Co-authored-by: Roc Wong <roc@kiwiberry.nz>
  • Loading branch information
mesqueeb and rocwang committed Dec 22, 2021
1 parent 03c830b commit 9a95384
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
17 changes: 9 additions & 8 deletions package.json
Expand Up @@ -16,21 +16,23 @@
},
"homepage": "https://grid.kiwiberry.nz/",
"files": [
"dist",
"src/*.*"
"dist"
],
"main": "./dist/vue-virtual-scroll-grid.umd.js",
"module": "./dist/vue-virtual-scroll-grid.es.js",
"module": "./dist/index.es.js",
"main": "./dist/index.umd.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/vue-virtual-scroll-grid.es.js",
"require": "./dist/vue-virtual-scroll-grid.umd.js"
"import": "./dist/index.es.js",
"require": "./dist/index.umd.js",
"types": "./dist/index.d.ts"
}
},
"license": "MIT",
"scripts": {
"gen:types": "vue-tsc --declaration --emitDeclarationOnly",
"serve": "vite preview",
"build": "vite build",
"build": "vite build && npm run gen:types",
"build:demo": "vite build --mode demo",
"dev": "vite",
"lint": "vue-tsc --noEmit --skipLibCheck",
Expand Down Expand Up @@ -61,7 +63,6 @@
"ts-jest": "^27.0.7",
"typescript": "^4.5.2",
"vite": "^2.6.13",
"vite-dts": "^1.0.3",
"vue": "^3.2.23",
"vue-tsc": ">=0.29.8"
},
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
@@ -0,0 +1,3 @@
import Grid from './Grid.vue'

export default Grid
6 changes: 4 additions & 2 deletions tsconfig.json
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"declaration": true,
"declaration": false,
"baseUrl": ".",
"outDir": "dist",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
Expand All @@ -12,5 +14,5 @@
"lib": ["esnext", "dom"],
"types": ["vite/client", "jest"],
},
"include": ["src/*.ts", "src/*.d.ts", "src/*.tsx", "src/*.vue"]
"include": ["src/*.ts", "src/*.tsx", "src/*.vue"]
}
6 changes: 3 additions & 3 deletions vite.config.ts
Expand Up @@ -3,11 +3,10 @@ import vue from "@vitejs/plugin-vue";
import { homedir } from "os";
import { existsSync, readFileSync } from "fs";
import { resolve } from "path";
import dts from "vite-dts";

export default ({ mode }: ConfigEnv): UserConfig => {
return {
plugins: [vue(), dts()],
plugins: [vue()],
server: {
open: true,
https: existsSync(`${homedir()}/.localhost_ssl/server.key`)
Expand All @@ -23,8 +22,9 @@ export default ({ mode }: ConfigEnv): UserConfig => {
? {}
: {
lib: {
entry: resolve(__dirname, "src/Grid.vue"),
entry: resolve(__dirname, "src/index.ts"),
name: "VirtualScrollGrid",
fileName: (format) => `index.${format}.js`,
},
rollupOptions: {
// Make sure to externalize deps that shouldn't be bundled
Expand Down

0 comments on commit 9a95384

Please sign in to comment.