fix: clean() no longer deletes and recreates BUILD_PATH This should fix issues with webservers with hot reloading. Signed-off-by: Anirudh <icyph0x@pm.me>
Anirudh icyph0x@pm.me
Thu, 27 Sep 2018 23:21:49 +0530
1 files changed,
11 insertions(+),
2 deletions(-)
jump to
M
vite/vite.py
→
vite/vite.py
@@ -181,8 +181,17 @@ sys.exit(1)
def clean(): - shutil.rmtree(BUILD_PATH) - os.makedirs(BUILD_PATH) + #shutil.rmtree(BUILD_PATH) + #os.makedirs(BUILD_PATH) + for f in os.listdir(BUILD_PATH): + fpath = os.path.join(BUILD_PATH, f) + try: + if os.path.isfile(fpath): + os.unlink(fpath) + elif os.path.isdir(fpath): + shutil.rmtree(fpath) + except Exception as e: + print(e) def builder():