Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nuxt): use default export for raw components (#25282)
- Loading branch information
1 parent
9d1ca7c
commit a551b21
Showing
5 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { addComponent, createResolver, defineNuxtModule } from 'nuxt/kit' | ||
|
||
export default defineNuxtModule({ | ||
meta: { | ||
name: 'import-components' | ||
}, | ||
setup () { | ||
const { resolve } = createResolver(import.meta.url) | ||
|
||
addComponent({ | ||
name: 'DCompClient', | ||
filePath: resolve('./runtime/components'), | ||
mode: 'client', | ||
}) | ||
|
||
addComponent({ | ||
name: 'DCompServer', | ||
filePath: resolve('./runtime/components'), | ||
mode: 'server', | ||
}) | ||
|
||
addComponent({ | ||
name: 'DCompAll', | ||
filePath: resolve('./runtime/components'), | ||
mode: 'all', | ||
}) | ||
|
||
addComponent({ | ||
name: 'NCompClient', | ||
export: 'NComp', | ||
filePath: resolve('./runtime/components'), | ||
mode: 'client', | ||
}) | ||
|
||
addComponent({ | ||
name: 'NCompServer', | ||
export: 'NComp', | ||
filePath: resolve('./runtime/components'), | ||
mode: 'server', | ||
}) | ||
|
||
addComponent({ | ||
name: 'NCompAll', | ||
export: 'NComp', | ||
filePath: resolve('./runtime/components'), | ||
mode: 'all', | ||
}) | ||
}, | ||
}) |
13 changes: 13 additions & 0 deletions
13
test/fixtures/basic/modules/import-components/runtime/components.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineComponent, h } from 'vue' | ||
|
||
export default defineComponent({ | ||
name: 'DComp', | ||
props: { message: String }, | ||
render: (props: any) => h('h1', props.message), | ||
}) | ||
|
||
export const NComp = defineComponent({ | ||
name: 'NComp', | ||
props: { message: String }, | ||
render: (props: any) => h('h1', props.message), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<div> | ||
<DCompAll message="default-comp-all" /> | ||
<DCompClient message="default-comp-client" /> | ||
<DCompServer message="default-comp-server" /> | ||
<NCompAll message="named-comp-all" /> | ||
<NCompClient message="named-comp-client" /> | ||
<NCompServer message="named-comp-server" /> | ||
</div> | ||
</template> |