File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
dev-packages/rollup-utils/plugins Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,12 @@ export function makeDebugBuildStatementReplacePlugin() {
7373}
7474
7575export function makeProductionReplacePlugin ( ) {
76- const pattern = / \/ \* r o l l u p - i n c l u d e - d e v e l o p m e n t - o n l y \* \/ [ \s \S ] * ?\/ \* r o l l u p - i n c l u d e - d e v e l o p m e n t - o n l y - e n d \* \/ \s * / g;
76+ // Use legal comments (/*!) so they're preserved by Rolldown
77+ // NOTE: Due to a Rolldown limitation, the ending comment must be placed before a statement
78+ // (e.g., before a return) rather than after a block, otherwise it gets stripped.
79+ // See: https://github.com/rolldown/rolldown/issues/[TODO: file issue]
80+ const pattern =
81+ / \/ \* ! r o l l u p - i n c l u d e - d e v e l o p m e n t - o n l y \* \/ [ \s \S ] * ?\/ \* ! r o l l u p - i n c l u d e - d e v e l o p m e n t - o n l y - e n d \* \/ \s * / g;
7782
7883 function stripDevBlocks ( code ) {
7984 if ( ! code ) return null ;
Original file line number Diff line number Diff line change @@ -94,15 +94,14 @@ export function init(options: BrowserOptions = {}): Client | undefined {
9494 let defaultIntegrations =
9595 options . defaultIntegrations == null ? getDefaultIntegrations ( options ) : options . defaultIntegrations ;
9696
97- /* rollup-include-development-only */
97+ /*! rollup-include-development-only */
9898 if ( options . spotlight ) {
9999 if ( ! defaultIntegrations ) {
100100 defaultIntegrations = [ ] ;
101101 }
102102 const args = typeof options . spotlight === 'string' ? { sidecarUrl : options . spotlight } : undefined ;
103103 defaultIntegrations . push ( spotlightBrowserIntegration ( args ) ) ;
104104 }
105- /* rollup-include-development-only-end */
106105
107106 const clientOptions : BrowserClientOptions = {
108107 ...options ,
@@ -114,6 +113,9 @@ export function init(options: BrowserOptions = {}): Client | undefined {
114113 } ) ,
115114 transport : options . transport || makeFetchTransport ,
116115 } ;
116+ // TODO: This is here to avoid the Rolldown limitation of not being able to place the ending comment after a block
117+ // Should be moved back after the if block once the Rolldown limitation is fixed
118+ /*! rollup-include-development-only-end */
117119 return initAndBind ( BrowserClient , clientOptions ) ;
118120}
119121
You can’t perform that action at this time.
0 commit comments