fix: run ”yarn dev“ error in window

pull/402/head
star sky 4 years ago
parent 508e9eb912
commit 32d86454f3

@ -1,18 +1,26 @@
const fs = require('fs-extra')
const chokidar = require('chokidar')
const { normalizePath } = require('vite')
function toClientAndNode(method, file) {
const normalize_file = normalizePath(file)
if (method === 'copy') {
fs.copy(file, file.replace(/^src\/shared\//, 'src/node/'))
fs.copy(file, file.replace(/^src\/shared\//, 'src/client/'))
fs.copy(
normalize_file,
normalize_file.replace(/^src\/shared\//, 'src/node/')
)
fs.copy(
normalize_file,
normalize_file.replace(/^src\/shared\//, 'src/client/')
)
} else if (method === 'remove') {
fs.remove(file.replace(/^src\/shared\//, 'src/node/'))
fs.remove(file.replace(/^src\/shared\//, 'src/client/'))
fs.remove(normalize_file.replace(/^src\/shared\//, 'src/node/'))
fs.remove(normalize_file.replace(/^src\/shared\//, 'src/client/'))
}
}
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.

Loading…
Cancel
Save