Skip to content

Commit

Permalink
fix: sleep is not found in client
Browse files Browse the repository at this point in the history
  • Loading branch information
condorheroblog committed Oct 17, 2023
1 parent 603f7b5 commit 3c8f41e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/playground/ts-example/mock/nest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineFakeRoute } from "vite-plugin-fake-server/client";

export default defineFakeRoute({
url: "/mock/nest/:id",
timeout: 0,
response: ({ params }) => {
return {
...params,
Expand Down
3 changes: 2 additions & 1 deletion packages/vite-plugin-fake-server/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateMockServer } from "./build";
import { getResponse } from "./getResponse.mjs";
import { getResponse, sleep } from "./getResponse.mjs";
import type { FakeRoute } from "./node";
import { fakerSchemaServer, isFunction, loggerOutput } from "./node";
import { resolvePluginOptions } from "./resolvePluginOptions";
Expand Down Expand Up @@ -156,6 +156,7 @@ export const vitePluginFakeServer = async (options: VitePluginFakeServerOptions
children: `const fakeModuleList = window.__FAKE__MODULE__LIST__;
const { pathToRegexp, match } = window.__PATH_TO_REGEXP__;
__XHOOK__.before(async function(req, callback) {
${sleep.toString()}
${getResponse.toString()}
function headersToObject(headers) {
Expand Down

0 comments on commit 3c8f41e

Please sign in to comment.