修复build:ui打包出来的产物有问题bug,修复input组件本地开发报警告bug (#150)

* fix(grid): 修复cropperjs依赖超期的问题

* fix(build): 修复打包文件出错问题

* fix(input): 修复input组件本地开发报警告问题
This commit is contained in:
ajaxzheng 2023-04-18 23:29:35 -07:00 committed by GitHub
parent abd16d855b
commit 582fa0df84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 41 deletions

View File

@ -64,33 +64,33 @@ export const getBaseConfig = ({ vueVersion, dtsInclude, dts, buildTarget, themeV
...getVuePlugins(vueVersion),
dts
? dtsPlugin({
root: pathFromWorkspaceRoot(),
tsConfigFilePath: `tsconfig.vue${vueVersion}.json`,
aliasesExclude: [/@opentiny\/vue.+/],
compilerOptions: {
paths: {
...compilerOptions.paths,
// 一定要映射到 packages/vue 下对应的 vue 版本和 @vue/composition-api 才能正确生成 dts
'vue': [`packages/vue/node_modules/vue${vueVersion}`],
'@vue/runtime-core': ['packages/vue/node_modules/@vue/runtime-core'],
'@vue/runtime-dom': ['packages/vue/node_modules/@vue/runtime-dom'],
'@vue/composition-api': ['packages/vue/node_modules/@vue/composition-api']
root: pathFromWorkspaceRoot(),
tsConfigFilePath: `tsconfig.vue${vueVersion}.json`,
aliasesExclude: [/@opentiny\/vue.+/],
compilerOptions: {
paths: {
...compilerOptions.paths,
// 一定要映射到 packages/vue 下对应的 vue 版本和 @vue/composition-api 才能正确生成 dts
'vue': [`packages/vue/node_modules/vue${vueVersion}`],
'@vue/runtime-core': ['packages/vue/node_modules/@vue/runtime-core'],
'@vue/runtime-dom': ['packages/vue/node_modules/@vue/runtime-dom'],
'@vue/composition-api': ['packages/vue/node_modules/@vue/composition-api']
}
},
include: [...dtsInclude, 'packages/vue/*.d.ts'],
// 忽略类型检查错误,保证生成不会阻断
skipDiagnostics: true,
beforeWriteFile: (filePath, content) => {
return {
// "vue/src/alert/index.d.ts" ==> "alert/index.d.ts"
filePath: filePath.replace('/vue/src', '').replace('\\vue\\src', ''),
content: content
// vue 2.7 还不能正常识别 vue-common
.replace(/import\('[./]+vue-common.+'\)/, 'import("vue")')
.replace(/\("vue[1-9\.]+/g, '("vue')
}
}
},
include: [...dtsInclude, 'packages/vue/*.d.ts'],
// 忽略类型检查错误,保证生成不会阻断
skipDiagnostics: true,
beforeWriteFile: (filePath, content) => {
return {
// "vue/src/alert/index.d.ts" ==> "alert/index.d.ts"
filePath: filePath.replace('/vue/src', '').replace('\\vue\\src', ''),
content: content
// vue 2.7 还不能正常识别 vue-common
.replace(/import\('[./]+vue-common.+'\)/, 'import("vue")')
.replace(/\("vue[1-9\.]+/g, '("vue')
}
}
})
})
: undefined,
inlineChunksPlugin({ deleteInlinedFiles: true }),
generatePackageJsonPlugin({
@ -191,8 +191,6 @@ async function batchBuildAll({ vueVersion, tasks, formats, message, emptyOutDir,
utils.logGreen(`====== 开始构建 ${message} ======`)
const entry = toEntry(tasks)
const entryPathSet = new Set(Object.values(entry))
const dtsInclude = toTsInclude(tasks)
await build({
configFile: false,
@ -212,12 +210,6 @@ async function batchBuildAll({ vueVersion, tasks, formats, message, emptyOutDir,
return false
}
// 模块作为入口时不需要通过external分离
const srcPath = path.resolve(importer, '..', source.split('?')[0])
if (entryPathSet.has(srcPath)) {
return false
}
// 图标入口排除子图标
if (/vue-icon\/(index|lowercase)/.test(importer)) {
return /^\.\//.test(source)
@ -306,7 +298,14 @@ function getTasks(names: string[]): Module[] {
export async function buildUi(
names: string[] = [],
{ vueVersions = ['2', '3'], buildTarget = '8.0', formats = ['es'], clean = false, dts = true, themeVersion }: BuildUiOption
{
vueVersions = ['2', '3'],
buildTarget = '8.0',
formats = ['es'],
clean = false,
dts = true,
themeVersion
}: BuildUiOption
) {
// 是否清空构建目录
let emptyOutDir = clean

View File

@ -4,11 +4,11 @@
"description": "",
"main": "lib/index.js",
"module": "index.ts",
"devDependencies": {
"devDependencies": {
"@opentiny-internal/vue-test-utils": "workspace:*",
"vitest": "^0.25.7"
},
"scripts": {
"scripts": {
"build": "pnpm -w build:ui $npm_package_name",
"//postversion": "pnpm build"
},
@ -16,7 +16,7 @@
"@opentiny/vue-common": "workspace:~",
"@opentiny/vue-renderless": "workspace:~",
"@opentiny/vue-icon": "workspace:~",
"cropperjs": "1.5.7"
"cropperjs": "1.5.13"
},
"license": "MIT"
}

View File

@ -73,7 +73,7 @@ export default defineComponent({
},
contentStyle: {
type: Object,
default: {}
default: () => ({})
},
isSelect: {
type: Boolean,
@ -121,5 +121,4 @@ export default defineComponent({
setup(props, context) {
return $setup({ props, context, template })
}
}
)
})