Skip to content

Commit

Permalink
Render emtpy block comments after tree-shaken statements (#5231)
Browse files Browse the repository at this point in the history
Render emtpy blick comments after tree-shaken statements
  • Loading branch information
lukastaegert authored Oct 31, 2023
1 parent 17d33a9 commit 835a7fa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/renderHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function findFirstLineBreakOutsideComment(code: string): [number, number]
// With our assumption, '/' always starts a comment. Determine comment type:
charCodeAfterSlash = code.charCodeAt(start + 1);
if (charCodeAfterSlash === 47 /*"/"*/) return [start, lineBreakPos + 1];
start = code.indexOf('*/', start + 3) + 2;
start = code.indexOf('*/', start + 2) + 2;
if (start > lineBreakPos) {
lineBreakPos = code.indexOf('\n', start);
}
Expand Down
3 changes: 3 additions & 0 deletions test/form/samples/empty-block-comment/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = defineTest({
description: 'renders empty block comments after tree-shaken statements (#5230)'
});
4 changes: 4 additions & 0 deletions test/form/samples/empty-block-comment/_expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function instance() {
}

export { instance };
3 changes: 3 additions & 0 deletions test/form/samples/empty-block-comment/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function instance() {
const b = 2; /**/
}

0 comments on commit 835a7fa

Please sign in to comment.