diff --git a/scripts/copyClient.js b/scripts/copyClient.js index 5f6e0f7c..576aeaf3 100644 --- a/scripts/copyClient.js +++ b/scripts/copyClient.js @@ -1,10 +1,12 @@ const fs = require('fs-extra') const glob = require('globby') +const { normalizePath } = require('vite') -function toDest(file) { +function toDist(file) { + file = normalizePath(file) return file.replace(/^src\//, 'dist/') } glob.sync('src/client/**/!(*.ts|tsconfig.json)').forEach((file) => { - fs.copy(file, toDest(file)) + fs.copy(file, toDist(file)) }) diff --git a/scripts/watchAndCopy.js b/scripts/watchAndCopy.js index 806b41cd..c1386ccb 100644 --- a/scripts/watchAndCopy.js +++ b/scripts/watchAndCopy.js @@ -1,7 +1,9 @@ const fs = require('fs-extra') const chokidar = require('chokidar') +const { normalizePath } = require('vite') function toClientAndNode(method, file) { + file = normalizePath(file) if (method === 'copy') { fs.copy(file, file.replace(/^src\/shared\//, 'src/node/')) fs.copy(file, file.replace(/^src\/shared\//, 'src/client/')) @@ -12,6 +14,7 @@ function toClientAndNode(method, file) { } function toDist(file) { + file = normalizePath(file) return file.replace(/^src\//, 'dist/') }