Skip to content

Commit 61aee5e

Browse files
fix
1 parent 9d51d4d commit 61aee5e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compress.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ function compressFile(filePath) {
3333
let content = fs.readFileSync(filePath, 'utf8');
3434

3535
if (filePath.endsWith('.js')) {
36-
content = content.replace(/(^|[^"'\`])\/\/.*\n/g, '$1\n');
37-
}
36+
content = content.replace(/(?<!["'`])\/\/.*\n/g, '\n');
37+
}
3838

3939
content = content.replace(/(\s*["'`])([^"'\n`]*)(["'`]\s*)/g, (match, p1, p2, p3) => {
4040
return p1 + p2.replace(/\s+/g, ' ') + p3;

0 commit comments

Comments
 (0)