Skip to content

Commit

Permalink
feat: isCustomElement option array to merge
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Feb 15, 2024
1 parent c41b385 commit fe94ed5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 4 additions & 6 deletions packages/valaxy-addon-meting/valaxy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { defineValaxyConfig } from 'valaxy'

export default defineValaxyConfig({
vue: {
template: {
compilerOptions: {
isCustomElement: (tag) => {
return tag === 'meting-js'
},
isCustomElement: [
(tag) => {
return tag === 'meting-js'
},
},
],
},
})
8 changes: 5 additions & 3 deletions packages/valaxy/node/plugins/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ export async function ViteValaxyPlugins(
include: [/\.vue$/, /\.md$/],
exclude: [],
template: {
...valaxyConfig.vue?.template,
compilerOptions: {
...valaxyConfig.vue?.template?.compilerOptions,
isCustomElement: (tag) => {
return customElements.has(tag) || valaxyConfig.vue?.template?.compilerOptions?.isCustomElement?.(tag)
let is = customElements.has(tag)
valaxyConfig.vue?.isCustomElement?.forEach((fn) => {
is = is || fn(tag)
})
return is
},
},
},
Expand Down
4 changes: 3 additions & 1 deletion packages/valaxy/node/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export interface ValaxyExtendConfig {
* @vitejs/plugin-vue options
* @see https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/README.md
*/
vue?: Parameters<typeof Vue>[0]
vue?: Parameters<typeof Vue>[0] & {
isCustomElement?: ((tag: string) => boolean)[]
}
// unplugin
components?: Parameters<typeof Components>[0]
layouts?: Parameters<typeof Layouts>[0]
Expand Down

1 comment on commit fe94ed5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://65cdc9fe6215e782ba3d507c--valaxy.netlify.app

Please sign in to comment.