Skip to content

Commit

Permalink
fix(medusa): Hot reloading on Windows (#2105)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-r-l-rodrigues authored Aug 29, 2022
1 parent 4c18c92 commit 846ae63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shiny-crabs-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---

Fix development hot reload on Windows
7 changes: 6 additions & 1 deletion packages/medusa/src/commands/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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\"`, {
Expand Down

0 comments on commit 846ae63

Please sign in to comment.