Skip to content

Commit

Permalink
⚙️ config: 尝试配置,生成类型声明文件;
Browse files Browse the repository at this point in the history
  • Loading branch information
ruan-cat committed Sep 30, 2024
1 parent 87ce0c0 commit 3cea15e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ dist
.yarn/install-state.gz
.pnp.*

# 忽略常见的vue类型声明文件
auto-imports.d.ts
components.d.ts

# 项目也使用 webstorm 来打开项目 故忽略该内容
.idea

Expand Down
2 changes: 2 additions & 0 deletions learn-create-compoents-lib/resolver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function GieResolver() {
return {
type: "component",
resolve: (name) => {
console.log(" in name ", name);

if (name.startsWith("Gie")) {
const partialName = name.slice(3);
return {
Expand Down
2 changes: 2 additions & 0 deletions learn-create-compoents-lib/test-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"types": [
// "@giegie/components/global.d.ts"
// "@giegie/components"
"./components.d.ts",
"./auto-imports.d.ts"
]
}
}
3 changes: 3 additions & 0 deletions learn-create-compoents-lib/test-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import AutoImport from "unplugin-auto-import/vite";
// FIXME: 处理类型声明问题 这是一个纯js文件
import { GieResolver } from "@giegie/resolver";

// console.log(" GieResolver ", GieResolver);

// https://vitejs.dev/config/
export default defineConfig({
server: {
Expand All @@ -15,6 +17,7 @@ export default defineConfig({
vue(),

Components({
dts: true,
resolvers: [GieResolver()],
}),

Expand Down

0 comments on commit 3cea15e

Please sign in to comment.