fix(nuxt): use resolved path for test component import

This commit is contained in:
Daniel Roe 2024-05-07 13:56:13 +01:00
parent 9e8261a69c
commit 8e793ad5cc
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -16,9 +16,9 @@ export default (url: string) => defineComponent({
if (!path.startsWith(devRootDir)) { if (!path.startsWith(devRootDir)) {
throw new Error(`[nuxt] Cannot access path outside of project root directory: \`${path}\`.`) throw new Error(`[nuxt] Cannot access path outside of project root directory: \`${path}\`.`)
} }
const comp = await import(/* @vite-ignore */ query.path as string).then(r => r.default) const comp = await import(/* @vite-ignore */ path as string).then(r => r.default)
return () => [ return () => [
h('div', 'Component Test Wrapper for ' + query.path), h('div', 'Component Test Wrapper for ' + path),
h('div', { id: 'nuxt-component-root' }, [ h('div', { id: 'nuxt-component-root' }, [
h(comp, { ...attrs, ...props, ...urlProps }), h(comp, { ...attrs, ...props, ...urlProps }),
]), ]),