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

Fix Pages tmp dir location #7441

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/wrangler/e2e/pages-dev.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { existsSync } from "node:fs";
import path from "node:path";
import { setTimeout } from "node:timers/promises";
import getPort from "get-port";
import dedent from "ts-dedent";
Expand Down Expand Up @@ -454,7 +456,7 @@ describe.each([{ cmd: "wrangler pages dev" }])("Pages $cmd", ({ cmd }) => {
});

describe("watch mode", () => {
it("should modify worker during dev session (Functions)", async () => {
it.only("should modify worker during dev session (Functions)", async () => {
const helper = new WranglerE2ETestHelper();

await helper.seed({
Expand Down Expand Up @@ -482,6 +484,11 @@ describe.each([{ cmd: "wrangler pages dev" }])("Pages $cmd", ({ cmd }) => {

text = await fetchText(url);
expect(text).toBe("Updated Worker!");

// Ensure Wrangler doesn't write tmp files in the functions directory—regression test for https://github.com/cloudflare/workers-sdk/issues/7440
expect(
existsSync(path.join(helper.tmpPath, "functions/.wrangler"))
).toBeFalsy();
});

it("should support modifying dependencies during dev session (Functions)", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/wrangler/src/pages/functions/buildWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { FatalError } from "../../errors";
import { logBuildFailure, logger } from "../../logger";
import { getBasePath } from "../../paths";
import { getPagesTmpDir } from "../utils";
import { getPagesProjectRoot, getPagesTmpDir } from "../utils";
import type { BundleResult } from "../../deployment-bundle/bundle";
import type { Entry } from "../../deployment-bundle/entry";
import type { CfModule } from "../../deployment-bundle/worker";
Expand Down Expand Up @@ -90,7 +90,7 @@ export function buildWorkerFromFunctions({
checkFetch: local && checkFetch,
targetConsumer: local ? "dev" : "deploy",
local,
projectRoot: functionsDirectory,
projectRoot: getPagesProjectRoot(),
defineNavigatorUserAgent,

legacyAssets: undefined,
Expand Down
Loading