mkdist
mkdist copied to clipboard
The packaged Vue3 component props. ts cannot call the props. ts type properly
Environment
os: Ubuntu 22.04 node: v20.17.0 vue: 3.4.37 unbuild: 2.0.0
Reproduction
Describe the bug
- The packaged Vue3 component props. ts cannot call the props. ts type properly
- I don't know why the components encapsulated in dist compiled from docs can still be used normally
- Uncaught SyntaxError: The requested module '/@fs/work/kylin/github/k-naiveui-pro/packages/k-naiveui-pro/dist/components/ProBaseForm/index.mjs' does not provide an export named 'ProBaseFormColumn' (at ProBaseForm.vue:3:28)
- In reality, I is exporting ProBaseForm (ProBaseForm/props.ts)[https://github.com/InfernalAzazel/k-naiveui-pro/blob/main/packages/k-naiveui-pro/src/components/ProBaseForm/props.ts]
import type { FormProps} from 'naive-ui'
import type { VNode } from 'vue';
export interface ProBaseFormColumn {
label: string
prop: string
component: string | VNode
props?: Record<string, any>
span?: number
show?: boolean
}
export interface ProBaseFormProps extends /* @vue-ignore */ FormProps {
columns: ProBaseFormColumn[],
cols?: number
xGap?: number
yGap?: number
columnsSpan?: number
footerSpan?: number
collapsed?: boolean
collapsedRows?: number
}
This is my packaging configuration
import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({
entries: [
{ builder: 'mkdist', input: './src', pattern: ['**/*.vue'], loaders: ['vue'] },
{ builder: 'mkdist', input: './src', pattern: ['**/*.ts'], format: 'cjs', loaders: ['js'] },
{ builder: 'mkdist', input: './src', pattern: ['**/*.ts'], format: 'esm', loaders: ['js'] },
],
declaration: true,
clean: true,
// externals: [
// 'vue',
// 'naive-ui',
// 'unplugin-vue-components',
// ],
})
Additional context
- pnpm docs:dev (Exception occurred)
2.Compile dist and upload it to GitHub page(natural)
Logs
Uncaught SyntaxError: The requested module '/@fs/work/kylin/github/k-naiveui-pro/packages/k-naiveui-pro/dist/components/ProBaseForm/index.mjs' does not provide an export named 'ProBaseFormColumn' (at ProBaseForm.vue:3:28)