From 7685d66c0775167994150e61a8b628ad6289ce23 Mon Sep 17 00:00:00 2001 From: Adrien de Peretti Date: Thu, 22 May 2025 15:30:39 +0200 Subject: [PATCH] fix(framework): Fix compiler to create the dist after clean-up (#12582) * fix(framework): Fix compiler to create the dist after clean-up * Create angry-stingrays-fetch.md --- .changeset/angry-stingrays-fetch.md | 5 +++++ packages/core/framework/src/build-tools/compiler.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/angry-stingrays-fetch.md diff --git a/.changeset/angry-stingrays-fetch.md b/.changeset/angry-stingrays-fetch.md new file mode 100644 index 0000000000..191c7f29df --- /dev/null +++ b/.changeset/angry-stingrays-fetch.md @@ -0,0 +1,5 @@ +--- +"@medusajs/framework": patch +--- + +fix(framework): Fix compiler to create the dist after clean-up diff --git a/packages/core/framework/src/build-tools/compiler.ts b/packages/core/framework/src/build-tools/compiler.ts index c697c0fa42..e935bb5e5f 100644 --- a/packages/core/framework/src/build-tools/compiler.ts +++ b/packages/core/framework/src/build-tools/compiler.ts @@ -1,7 +1,7 @@ import type { AdminOptions, ConfigModule, Logger } from "@medusajs/types" import { FileSystem, getConfigFile, getResolvedPlugins } from "@medusajs/utils" import chokidar from "chokidar" -import { access, constants, copyFile, rm } from "fs/promises" +import { access, constants, copyFile, mkdir, rm } from "fs/promises" import path from "path" import type tsStatic from "typescript" @@ -284,6 +284,11 @@ export class Compiler { ) await this.#clean(dist) + /** + * Create first the target directory now that everything is clean + */ + await mkdir(dist, { recursive: true }) + /** * Step 2: Compile TypeScript source code */