jizai1125 / vue-countup-v3

A Vue 3 Component for animation counting.
https://jizai1125.github.io/vue-countup-v3/examples
163 stars 4 forks source link

InertiaJs error on SSR. #24

Closed amstrad closed 3 months ago

amstrad commented 3 months ago

Hi, getting this error when trying SSR with InertiaJs. Did try to wrap the implementation with (vite method) and (vuetify), but no success

Stack is: Laravel11+inertiaJs and Vue3+vuetify in the front.

file:///var/www/html/bootstrap/ssr/ssr.js:8
import CountUp from "vue-countup-v3";
       ^^^^^^^
SyntaxError: The requested module 'vue-countup-v3' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

Node.js v20.13.1

Would appreciate any info. As this is an SSR problem, i´m not able to provide a way to replicate it. Component works fine in dev mode (vite --host). Crashes appears only when initializing the SSR server by vite (php artisan inertia:start-ssr)

Removing the component from my imports gets everything fine

php artisan inertia:start-ssr        ✔  48s   3.0.0   14:55:40 
Starting SSR server on port 13714...
Inertia SSR server started.
jizai1125 commented 3 months ago

Does InertiaJs provide a way to render components only on the client-side?

amstrad commented 3 months ago

Hi. Yes, thanks. Made it work adding it to the noExternal array in vite.config.js,

    ssr: {
        noExternal: ["@inertiajs/server", "vuetify", "vue-countup-v3"],
    },