Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HMR support for schema reloads #3

Closed
tobiasdiez opened this issue Oct 26, 2022 · 0 comments · Fixed by #13
Closed

Add HMR support for schema reloads #3

tobiasdiez opened this issue Oct 26, 2022 · 0 comments · Fixed by #13
Labels
enhancement New feature or request status: blocked

Comments

@tobiasdiez
Copy link
Owner

tobiasdiez commented Oct 26, 2022

Requires vitejs/vite#10324 and vitejs/vite#10333 (Vite 3.2, which is in nuxt rc 13). Then the following should work:

    let viteServer: ViteDevServer | undefined;
    if (nuxt.options.dev) {
      nuxt.hook('vite:serverCreated', (devServer: ViteDevServer, ctx) => {
        if (ctx.isServer) {
          viteServer = devServer;
        }
      });
    }
    // If schema file changes:
    viteServer.reloadModule("#graphql/schema") 

Same for updating the template using updateTemplate, which will be introduced in nuxt rc13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request status: blocked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant