diff --git a/.changeset/shiny-crabs-unite.md b/.changeset/shiny-crabs-unite.md new file mode 100644 index 0000000000000..2a57e075a194a --- /dev/null +++ b/.changeset/shiny-crabs-unite.md @@ -0,0 +1,5 @@ +--- +"@medusajs/medusa": patch +--- + +Fix development hot reload on Windows diff --git a/packages/medusa/src/commands/develop.js b/packages/medusa/src/commands/develop.js index 253e175e37300..27fdeb43f9152 100644 --- a/packages/medusa/src/commands/develop.js +++ b/packages/medusa/src/commands/develop.js @@ -5,7 +5,7 @@ import chokidar from "chokidar" import Logger from "../loaders/logger" -export default async function ({ port, directory }) { +export default async function({ port, directory }) { const args = process.argv args.shift() args.shift() @@ -28,6 +28,11 @@ export default async function ({ port, directory }) { chokidar.watch(`${directory}/src`).on("change", (file) => { const f = file.split("src")[1] Logger.info(`${f} changed: restarting...`) + + if (process.platform === "win32") { + execSync(`taskkill /PID ${child.pid} /F /T`) + } + child.kill("SIGINT") execSync(`${babelPath} src -d dist --extensions \".ts,.js\"`, {