Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli/facade/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ const dev = ({ local, logger }: { logger: Logger; local: Local }) =>
hotReloading,
liveReloadPort: liveReload.port,
local: true,
enableComponentConsoleOutput: true,
postRequestPayloadSize,
components: opts.components,
path: path.resolve(componentsDir),
Expand Down
4 changes: 4 additions & 0 deletions src/registry/domain/options-sanitiser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ export default function optionsSanitiser(input: RegistryOptions): Config {
options.tarExtractMode = 766;
}

if (typeof options.enableComponentConsoleOutput === 'undefined') {
options.enableComponentConsoleOutput = false;
}

if (
typeof options.fallbackRegistryUrl !== 'undefined' &&
!options.fallbackRegistryUrl.endsWith('/')
Expand Down
4 changes: 3 additions & 1 deletion src/registry/routes/helpers/get-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,9 @@ export default function getComponent(conf: Config, repository: Repository) {
exports: {} as Record<string, (...args: any[]) => any>
},
exports: {} as Record<string, (...args: any[]) => any>,
console: conf.local ? console : noopConsole,
console: conf.enableComponentConsoleOutput
? console
: noopConsole,
setTimeout,
Buffer,
AbortController: globalThis?.AbortController,
Expand Down
8 changes: 8 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ export interface Config<T = any> {
* system (`true`) or from the remote storage (`false`).
*/
local: boolean;
/**
* Enables component console output (console.log, console.error, etc.)
* during component execution. Useful for debugging in development and
* lower environments.
*
* @default false
*/
enableComponentConsoleOutput: boolean;
/**
* File and directory mode (octal) applied when extracting tarballs during
* publishing.
Expand Down