Skip to content

Commit

Permalink
fix: 🩹 修复因类型无法引入导致无法打包问题
Browse files Browse the repository at this point in the history
  • Loading branch information
skiyee committed Jul 27, 2024
1 parent e2101c1 commit fbdf67f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import process from 'node:process'
import { resolve } from 'node:path'
import { promises as fs } from 'node:fs'

import { type Plugin, createFilter } from 'vite'
import type { Plugin } from 'vite'
import { createFilter } from 'vite'
import { MagicString } from 'vue/compiler-sfc'

import { findNode, loadPagesJson, parseSFC } from './utils'
Expand Down
14 changes: 13 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ export function toPascalCase(str: string) {
.replace(/(^\w|-+\w)/g, match => match.toUpperCase().replace(/-/g, ''))
}

export function findNode(sfc: SFCDescriptor, rawTagName: string) {
interface TagNode {
loc: {
source: string
start: {
offset: number
}
end: {
offset: number
}
}
}

export function findNode(sfc: SFCDescriptor, rawTagName: string): TagNode | undefined {
const templateSource = sfc.template?.content

if (!templateSource)
Expand Down

0 comments on commit fbdf67f

Please sign in to comment.