remove filename comments

This commit is contained in:
2022-06-09 10:56:50 -05:00
parent 6e881ebd6f
commit 57f7599739
3 changed files with 38 additions and 4 deletions

View File

@@ -112,7 +112,7 @@ function runEsbuild(opts, watchCallback, toWatch = false) {
let res = (0, esbuild_1.buildSync)(opts);
let content = '';
if (res.outputFiles && res.outputFiles.length > 0) {
content = res.outputFiles[0].text;
content = clearFilenameComments(res.outputFiles[0].text);
}
if (content === '') {
return {
@@ -132,4 +132,20 @@ function runEsbuild(opts, watchCallback, toWatch = false) {
};
}
}
// //only remove the filename comments if there's only 1 file
// function clearFilenameComments(content: string): string {
// let regexp = new RegExp(`//\\s*${ScriptBase}/.*(?:\\n|$)`, 'g')
// let matches = content.match(regexp)
// if (matches) {
// if (matches.length === 1) {
// content = content.replace(regexp, '')
// }
// }
// return content
// }
//remove all filename comments
function clearFilenameComments(content) {
let regexp = new RegExp(`//\\s*${paths_1.ScriptBase}/.*(?:\\n|$)`, 'g');
return content.replace(regexp, '');
}
//# sourceMappingURL=build.js.map