Closed PascalAOMS closed 2 years ago
@PascalAOMS Can you downgrade to vite@2.7.x
? I haven't had the chance yet to check 2.8 and it looks like something is not backwards compatible. I guess you used a package manager differnt from Yarn, right? Otherwise it should have respected yarn.lock
.
Thank you for the quick response.
Oh wow, it worked with Yarn using the correct lock file.
Appreciate your help.
https://github.com/frandiox/vite-ssr/discussions/143#discussioncomment-2294141 I just made a fix for vite 2.8.x. Can you check it out?
I got the same error.
/node_modules/vite-ssr/vue/entry-client.js:24
ReferenceError: window is not defined
Did some debug a bit. There no check on client or server as window is null.
/node_modules/vite-ssr/vue/entry-client.js
let url;
if (import.meta.env.SSR) {
console.log("server")
url = import.meta.env.BASE_URL;//not sure if correct
}else{
console.log("client")
url = new URL(window.location.href);
}
Found another error that vue-router error on window is null.
I cloned this repo to try out the Vue example.
Installed all the packages defined in
package.json
and was wondering why it didn't work out of the box.The first error is this:
So I went into
vue/src/main.ts
and changedimport viteSSR, { ClientOnly } from 'vite-ssr'
toimport viteSSR, { ClientOnly } from 'vite-ssr/vue'
.Now the server starts but upon visiting localhost:1337 I get this:
How shall I fix this?
Thank you.