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

Not working in preview mode #26

Open
Profesor08 opened this issue Oct 11, 2023 · 1 comment
Open

Not working in preview mode #26

Profesor08 opened this issue Oct 11, 2023 · 1 comment

Comments

@Profesor08
Copy link

If you start build preview vite preview of npm run preview, it not working, any api request returns index page.

@Profesor08
Copy link
Author

Profesor08 commented Oct 12, 2023

There are the docs https://vitejs.dev/guide/api-plugin.html#configurepreviewserver

import { Connect, Plugin, PreviewServerForHook, ViteDevServer } from "vite";

export const ViteMockServer = (options?: MockOptions): Plugin => {
  return {
    name: PLUGIN_NAME,
    configureServer: createConfiguratedServer(options),
    configurePreviewServer: createConfiguratedServer(options),
  };
};

const createConfiguratedServer = (options: MockOptions = {}) => {
  return async (server: ViteDevServer | PreviewServerForHook) => {
    // code
  };
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant