Skip to content

Commit c1513b6

Browse files
Creating enableComponentConsoleOutput option to allow components to enable/disable console output explicitly
1 parent 88a686c commit c1513b6

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/registry/routes/helpers/get-component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,9 @@ export default function getComponent(conf: Config, repository: Repository) {
676676
exports: {} as Record<string, (...args: any[]) => any>
677677
},
678678
exports: {} as Record<string, (...args: any[]) => any>,
679-
console: conf.local ? console : noopConsole,
679+
console: conf.enableComponentConsoleOutput
680+
? console
681+
: noopConsole,
680682
setTimeout,
681683
Buffer,
682684
AbortController: globalThis?.AbortController,

src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ export interface Config<T = any> {
289289
* system (`true`) or from the remote storage (`false`).
290290
*/
291291
local: boolean;
292+
/**
293+
* Enables component console output (console.log, console.error, etc.)
294+
* during component execution. Useful for debugging in development and
295+
* lower environments.
296+
*
297+
* @default false
298+
*/
299+
enableComponentConsoleOutput: boolean;
292300
/**
293301
* File and directory mode (octal) applied when extracting tarballs during
294302
* publishing.

0 commit comments

Comments
 (0)