fix(medusa): Hot reloading on Windows (#2105)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2022-08-29 15:46:15 +02:00
1 parent 4c18c9251c
commit 846ae637e2
2 files changed
+11 -1

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
Fix development hot reload on Windows
+6 -1
View File
@@ -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\"`, {