build: fix watchAndCopy script for windows (#402)

pull/401/head
Re_star 3 years ago committed by GitHub
parent 2e7130f7f0
commit 4d4be24a7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,9 @@
const fs = require('fs-extra') const fs = require('fs-extra')
const chokidar = require('chokidar') const chokidar = require('chokidar')
const { normalizePath } = require('vite')
function toClientAndNode(method, file) { function toClientAndNode(method, file) {
file = normalizePath(file)
if (method === 'copy') { if (method === 'copy') {
fs.copy(file, file.replace(/^src\/shared\//, 'src/node/')) fs.copy(file, file.replace(/^src\/shared\//, 'src/node/'))
fs.copy(file, file.replace(/^src\/shared\//, 'src/client/')) fs.copy(file, file.replace(/^src\/shared\//, 'src/client/'))
@ -12,7 +14,7 @@ function toClientAndNode(method, file) {
} }
function toDist(file) { function toDist(file) {
return file.replace(/^src\//, 'dist/') return normalizePath(file).replace(/^src\//, 'dist/')
} }
// copy shared files to the client and node directory whenever they change. // copy shared files to the client and node directory whenever they change.

Loading…
Cancel
Save