NetCoreTemplates / vue-vite

.NET 8 Jamstack Vue Vite App with Tailwind
13 stars 5 forks source link

useSWRV error on build #2

Closed hurricanepkt closed 1 year ago

hurricanepkt commented 1 year ago

Following commands and when it comes to :

cd ui && npm run build:local

Get error message :

[Vue warn]: Failed to resolve component: ErrorSummary
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: TextInput
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: CheckboxInput
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: SecondaryButton
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: PrimaryButton
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Component <Anonymous> is missing template or render function.
[Vue warn]: Component <Anonymous> is missing template or render function.
[Vue warn]: Component <Anonymous> is missing template or render function.
[Vue warn]: Component <Anonymous> is missing template or render function.
[Vue warn]: Non-function value encountered for default slot. Prefer function slots for better performance.
[Vue warn]: Component <Anonymous> is missing template or render function.
[Vue warn]: Non-function value encountered for default slot. Prefer function slots for better performance.
[Vue warn]: Component <Anonymous> is missing template or render function.
file:///C:/Users/mark.greenway/Desktop/Repos/yyy_trash/Lisa/ui/node_modules/vite-ssg/dist/shared/vite-ssg.62550b28.mjs:1046
        throw new Error(`${gray("[vite-ssg]")} ${red(`Error on page: ${cyan(route)}`)}
              ^

Error: [vite-ssg] Error on page: /
TypeError: useSWRV is not a function
    at SwrClient.get (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\.vite-ssg-temp\main.cjs:343:12)
    at setup (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\.vite-ssg-temp\assets\Index-65dd2db6.cjs:392:44)
    at _sfc_main$3.setup (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\.vite-ssg-temp\assets\Index-65dd2db6.cjs:406:25)
    at callWithErrorHandling (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:171:22)
    at setupStatefulComponent (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:7194:29)
    at setupComponent (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:7149:11)
    at renderComponentVNode (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:628:17)
    at Object.ssrRenderComponent (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:94:12)
    at C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\.vite-ssg-temp\assets\Index-65dd2db6.cjs:645:28
    at renderComponentSubTree (C:\Users\mark.greenway\Desktop\Repos\yyy_trash\Lisa\ui\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:710:17)
    at file:///C:/Users/mark.greenway/Desktop/Repos/yyy_trash/Lisa/ui/node_modules/vite-ssg/dist/shared/vite-ssg.62550b28.mjs:1046:15
    at async run (file:///C:/Users/mark.greenway/Desktop/Repos/yyy_trash/Lisa/ui/node_modules/vite-ssg/dist/shared/vite-ssg.62550b28.mjs:627:36)

Node.js v20.2.0

Full Source code here : https://github.com/hurricanepkt/Lisa

mythz commented 1 year ago

It looks like it's failing on the SSG build of useSWRV so I've just replaced it with our client.swr that's now built-in to @servicestack/vue in this commit: https://github.com/NetCoreTemplates/vue-ssg/commit/e9e8931f647817ce18f818bf70169befcdee76bc

This issue should now be resolved in new vue-ssg templates.

mythz commented 1 year ago

FYI I've added a nicer swrEffect replacement in this commit https://github.com/NetCoreTemplates/vue-ssg/commit/fc6c45d1d27209a565db8fda10b7b8627b9c4cad which uses Vue's watchEffect to detect property changes to simplify usage down to a wrist friendly syntax:

const api = client.swrEffect(() => new Hello({ name: props.name }))