antfu-collective / vite-ssg

Static site generation for Vue 3 on Vite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I updated the version of vite SSG,compilation failed

admin8756 opened this issue · comments

image
I am using vitesee template to build my blog
Because I saw that vite see updated NPM. In package json。 So I also updated my code.

Then the node is deleted_ Modules and yen lock

Then after re yarn install
Finally, it can't be compiled
image

Error comes from newly installed package vue3-danmaku

https://github.com/hellodigua/vue-danmaku/blob/7e110197baf3fd9473175d28e6b26c24795c28ad/src/lib/Danmaku.vue#L150-L151

Try wrapping your component with client-only component:

<client-only>
  <vue-danmaku :danmus="danmus"></vue-danmaku>
</client-only>

First of all, thank you for your reply
57f2420cc155b9eb1d555b328aa4f8d
image

Did vite SSG update anything. I can use it before. It can't be used now.

Any code that depends on browser APIs like document, window should only be run on client side.

const isClient = typeof window !== 'undefined'

if(isClient) {
  document.getElementById()
  const app = cloudbase.init({})
}

If you have dependencies that has side effects import them dynamically or import in head.

if(isClient) {
  const cloudbase = (await import('@cloudbase/js-sdk')).default;
  await import('@cloudbase/js-sdk/auth')
  const app = cloudbase.init({})
}

or

<!-- index.html -->
<head>
  <script src="/cloudbase.full.js"></script>
</head>

Wow. You're awesome. My problem is almost solved

image
I think it should be the last question. This is an error. Did taiwind give it to me

Thanks and respect again

It's an issue with critters GoogleChromeLabs/critters#86

This comment has workaround for it: GoogleChromeLabs/critters#86 (comment)

Thank you. I solved all the problems.

This is the blog I'm coding。

Because vite SSG has become great~

Welcome to have a look if you have time.

Finally, thank you very much

You're welcome, Your site looks cool 👌 Don't forget to close issue if your problem is solved 😉