fix:doric-cli when in dev mode,build bundle cause conflict

This commit is contained in:
pengfei.zhou 2021-03-02 11:50:12 +08:00 committed by osborn
parent bdd392e455
commit 4e5b1c94bf

View File

@ -60,12 +60,23 @@ async function doMerge(jsFile: string) {
export async function mergeMap(mapFile: string) { export async function mergeMap(mapFile: string) {
const buildMap = mapFile.replace(/bundle\//, 'build/') const lockFile = `${mapFile}.lock`;
if (fs.existsSync(buildMap)) { if (fs.existsSync(lockFile)) {
const mergedMap = createMergedSourceMapFromFiles([ console.log("In mergeMap,skip")
buildMap, return;
mapFile,
], true);
await fs.promises.writeFile(mapFile, mergedMap);
} }
await fs.promises.writeFile(lockFile, (new Date).toString(), "utf-8")
try {
const buildMap = mapFile.replace(/bundle\//, 'build/')
if (fs.existsSync(buildMap)) {
const mergedMap = createMergedSourceMapFromFiles([
buildMap,
mapFile,
], true);
await fs.promises.writeFile(mapFile, mergedMap);
}
} finally {
await fs.promises.unlink(lockFile)
}
} }