refactor: 子包里使用 createRequire 动态获取 PACKAGE_NAME

This commit is contained in:
Hooray
2026-05-17 13:28:12 +08:00
parent 749c55edbc
commit 58452d656c
5 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
import type { ImportsMap } from 'unplugin-auto-import/types'
import type { ComponentResolver, TypeImport } from 'unplugin-vue-components'
import { createRequire } from 'node:module'
const COMPONENT_PREFIX = 'Fa'
const PACKAGE_NAME = '@fantastic-admin/components'
const PACKAGE_NAME = createRequire(import.meta.url)('./package.json').name
const BASIC_COMPONENT_NAMES = [
'FaAlert',
+1 -1
View File
@@ -2,7 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"types": ["vite/client"]
"types": ["vite/client", "node"]
},
"include": [
"resolver.ts",
+1 -1
View File
@@ -3,7 +3,7 @@
"type": "module",
"version": "0.0.0",
"exports": {
".": "./index.ts",
".": "./src/index.ts",
"./resolver": "./resolver.ts"
},
"peerDependencies": {
+2 -1
View File
@@ -1,6 +1,7 @@
import type { ImportsMap } from 'unplugin-auto-import/types'
import { createRequire } from 'node:module'
const PACKAGE_NAME = '@fantastic-admin/composables'
const PACKAGE_NAME = createRequire(import.meta.url)('./package.json').name
const AUTO_IMPORT_NAMES = [
'usePagination',
+1 -1
View File
@@ -2,7 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"types": ["vite/client"]
"types": ["vite/client", "node"]
},
"include": [
"resolver.ts",