remove filename comments
This commit is contained in:
18
lib/build.js
18
lib/build.js
@@ -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
|
||||
Reference in New Issue
Block a user