Skip to content

Commit 6655efa

Browse files
authored
Merge pull request #5 from gadfly3173/ts-support
fix: fix #4 ts support
2 parents 97bafcf + c837029 commit 6655efa

File tree

7 files changed

+1338
-1316
lines changed

7 files changed

+1338
-1316
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ pnpm-debug.log*
2121
*.njsproj
2222
*.sln
2323
*.sw?
24+
25+
package/*.d.ts
26+
27+
src/*.d.ts

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"serve": "vue-cli-service serve",
88
"build": "vue-cli-service build",
99
"lint": "vue-cli-service lint",
10-
"lib": "vue-cli-service build --target lib --name vue3-tabs-chrome ./package/index.ts"
10+
"moveTs": "scp ./package/index.d.ts ./dist/vue3-tabs-chrome.common.d.ts && scp ./package/vue3-tabs-chrome.vue.d.ts ./dist/vue3-tabs-chrome.vue.d.ts",
11+
"lib": "vue-cli-service build --target lib --name vue3-tabs-chrome ./package/index.ts && npm run moveTs"
1112
},
1213
"files": [
1314
"dist/**.*"

package/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { App, Plugin } from 'vue'
2-
import Vue3TabsChrome from './vue3-tabs-chrome.vue'
2+
import Vue3TabsChrome, { Tab } from './vue3-tabs-chrome.vue'
33
import './theme-dark.less'
44

55
const install = (app: App) => {
@@ -8,6 +8,6 @@ const install = (app: App) => {
88

99
Vue3TabsChrome.install = install
1010

11-
export { Vue3TabsChrome }
11+
export { Vue3TabsChrome, Tab }
1212

1313
export default Vue3TabsChrome as unknown as Plugin

package/render-temp.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script>
1+
<script lang="ts">
22
import { defineComponent } from 'vue'
33
44
export default defineComponent({

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"declaration": true,
34
"target": "esnext",
45
"module": "esnext",
56
"strict": true,
@@ -38,4 +39,4 @@
3839
"exclude": [
3940
"node_modules"
4041
]
41-
}
42+
}

vue.config.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,21 @@ module.exports = {
66
productionSourceMap: false,
77
publicPath: process.env.NODE_ENV === 'production'
88
? '/vue3-tabs-chrome/'
9-
: '/'
9+
: '/',
10+
chainWebpack: config => {
11+
if (process.env.NODE_ENV === 'production') {
12+
config.module.rule('ts').uses.delete('cache-loader');
13+
config.module
14+
.rule('ts')
15+
.use('ts-loader')
16+
.loader('ts-loader')
17+
.tap(options => ({
18+
...options,
19+
transpileOnly: false,
20+
happyPackMode: false
21+
}));
22+
config.output.libraryExport = 'default';
23+
}
24+
},
25+
parallel: false
1026
}

yarn.lock

+1,310-1,310
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)