From 64bb3153e6c9e7ccd457c58c1496c201767d3004 Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 7 Oct 2021 16:17:15 -0400 Subject: [PATCH] Update watchAndCopy.js --- scripts/watchAndCopy.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/scripts/watchAndCopy.js b/scripts/watchAndCopy.js index cb840752..ff9f3e79 100644 --- a/scripts/watchAndCopy.js +++ b/scripts/watchAndCopy.js @@ -3,19 +3,13 @@ const chokidar = require('chokidar') const { normalizePath } = require('vite') function toClientAndNode(method, file) { - const normalize_file = normalizePath(file) + file = normalizePath(file) if (method === 'copy') { - fs.copy( - normalize_file, - normalize_file.replace(/^src\/shared\//, 'src/node/') - ) - fs.copy( - normalize_file, - normalize_file.replace(/^src\/shared\//, 'src/client/') - ) + fs.copy(file, file.replace(/^src\/shared\//, 'src/node/')) + fs.copy(file, file.replace(/^src\/shared\//, 'src/client/')) } else if (method === 'remove') { - fs.remove(normalize_file.replace(/^src\/shared\//, 'src/node/')) - fs.remove(normalize_file.replace(/^src\/shared\//, 'src/client/')) + fs.remove(file.replace(/^src\/shared\//, 'src/node/')) + fs.remove(file.replace(/^src\/shared\//, 'src/client/')) } }