File tree 2 files changed +18
-1
lines changed
src/server/optimizing-compiler
test/unit/modules/server-compiler
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,11 @@ function nodesToSegments (
225
225
} else if ( c . type === 2 ) {
226
226
segments . push ( { type : INTERPOLATION , value : c . expression } )
227
227
} else if ( c . type === 3 ) {
228
- segments . push ( { type : RAW , value : escape ( c . text ) } )
228
+ let text = escape ( c . text )
229
+ if ( c . isComment ) {
230
+ text = '<!--' + text + '-->'
231
+ }
232
+ segments . push ( { type : RAW , value : text } )
229
233
}
230
234
}
231
235
return segments
Original file line number Diff line number Diff line change
1
+ import { ssrCompile } from 'web/server/compiler'
2
+
3
+ describe ( 'ssrCompile options' , ( ) => {
4
+ it ( 'comments' , ( ) => {
5
+ const compiled = ssrCompile ( `
6
+ <div>
7
+ <!-- test comments -->
8
+ </div>
9
+ ` , { comments : true } )
10
+
11
+ expect ( compiled . render ) . toContain ( '<!-- test comments -->' )
12
+ } )
13
+ } )
You can’t perform that action at this time.
0 commit comments