danielroe / typed-vuex

🏦 A typed store accessor for vanilla Vuex.
https://typed-vuex.roe.dev
MIT License
353 stars 27 forks source link

fix: nuxtServerInit not working with nuxt-vite #248

Open mirabledictu opened 3 years ago

mirabledictu commented 3 years ago

Hi, it looks like nuxtServerInit ain't working when nuxt-vite and nuxt-typed-vuex are both in buildModules.

Here's a simple reproduction https://github.com/mirabledictu/test-vuex-vite

I have a simple console log there

export const actions = {
    nuxtServerInit(_context) {
        // This will not log if nuxt-typed-vuex is added to buildModules
        console.log('works')
    }
}

and in my nuxt.config.js

  buildModules: [
    // https://go.nuxtjs.dev/typescript
    '@nuxt/typescript-build',
    'nuxt-vite',
    'nuxt-typed-vuex',
  ],

  vite: {
    ssr: true
  }
}

When you try to run it, you will not get any logs from server.

Try to remove nuxt-vite or nuxt-typed-vuex in buildModules and it will work.

danielroe commented 3 years ago

How odd. Note that there are known issues with ssr in nuxt-vite.

mirabledictu commented 3 years ago

How odd. Note that there are known issues with ssr in nuxt-vite.

Noted on that

hotrungnhan commented 3 years ago

not only ssr mode ,but also csr mode . Not work with vite, do you have any plan to fix this isuee