Update watchAndCopy.js

pull/402/head
Evan You 4 years ago committed by GitHub
parent 32d86454f3
commit 64bb3153e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,19 +3,13 @@ const chokidar = require('chokidar')
const { normalizePath } = require('vite') const { normalizePath } = require('vite')
function toClientAndNode(method, file) { function toClientAndNode(method, file) {
const normalize_file = normalizePath(file) file = normalizePath(file)
if (method === 'copy') { if (method === 'copy') {
fs.copy( fs.copy(file, file.replace(/^src\/shared\//, 'src/node/'))
normalize_file, fs.copy(file, file.replace(/^src\/shared\//, 'src/client/'))
normalize_file.replace(/^src\/shared\//, 'src/node/')
)
fs.copy(
normalize_file,
normalize_file.replace(/^src\/shared\//, 'src/client/')
)
} else if (method === 'remove') { } else if (method === 'remove') {
fs.remove(normalize_file.replace(/^src\/shared\//, 'src/node/')) fs.remove(file.replace(/^src\/shared\//, 'src/node/'))
fs.remove(normalize_file.replace(/^src\/shared\//, 'src/client/')) fs.remove(file.replace(/^src\/shared\//, 'src/client/'))
} }
} }

Loading…
Cancel
Save