feat:protect debug error
This commit is contained in:
parent
d24b8a1789
commit
ebfcbdec15
@ -26,9 +26,7 @@ function fromDir(startPath, filter) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
function doMerge(startPath, fileName) {
|
function doMerge(startPath, fileName) {
|
||||||
// console.log('-- found: ', startPath, fileName);
|
|
||||||
const filePath = fileName ? path.join(startPath, fileName) : startPath
|
const filePath = fileName ? path.join(startPath, fileName) : startPath
|
||||||
// console.log('-- merge: ', filePath.replace(/bundle\//, 'build/'), filePath)
|
|
||||||
const mergedMap = SourceMapMerger.createMergedSourceMapFromFiles([
|
const mergedMap = SourceMapMerger.createMergedSourceMapFromFiles([
|
||||||
filePath.replace(/bundle\//, 'build/'),
|
filePath.replace(/bundle\//, 'build/'),
|
||||||
filePath,
|
filePath,
|
||||||
|
@ -16,15 +16,19 @@ setTimeout(() => {
|
|||||||
fs.readFile(path, 'utf-8', (error, data) => {
|
fs.readFile(path, 'utf-8', (error, data) => {
|
||||||
if (!path.endsWith('.map')) {
|
if (!path.endsWith('.map')) {
|
||||||
console.log('File change:', path)
|
console.log('File change:', path)
|
||||||
const sourceMap = doMerge(path + ".map")
|
try {
|
||||||
ws.connections.forEach(e => {
|
const sourceMap = doMerge(path + ".map")
|
||||||
e.sendText(JSON.stringify({
|
ws.connections.forEach(e => {
|
||||||
cmd: 'RELOAD',
|
e.sendText(JSON.stringify({
|
||||||
script: data,
|
cmd: 'RELOAD',
|
||||||
source: path.match(/[^/\\]*$/)[0],
|
script: data,
|
||||||
sourceMap,
|
source: path.match(/[^/\\]*$/)[0],
|
||||||
}))
|
sourceMap,
|
||||||
})
|
}))
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user