You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing from consola/core, the logger was created without reporters, resulting in logs not appearing in the console. This made debugging difficult as module messages weren’t displayed.
Fixed by changing the import path from consola/core to just consola, ensuring the logger is created with proper default reporters.
Ah, I now remember why I did use that import. It is to prevent including consola in the client bundle. Because, even if logger is only ever used inside a import.meta.server check, for some reason a lot of consola stuff is still included in the client bundle, where it's definitely not needed. Too bad it doesn't work that way on the server... I'll need to figure out how to get rid of it in client bundles.
I'm now overriding the contents of the logger file with export const logger = console for the client bundle via a build plugin. That solves the issue of consola being included in client bundles and makes it work correctly on the server. Also added a test to check the presence of the string consola in the playground's generated client bundles.
Thanks for your work and your quick response.
Awesome package!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When importing from
consola/core, the logger was created without reporters, resulting in logs not appearing in the console. This made debugging difficult as module messages weren’t displayed.Fixed by changing the import path from
consola/coreto justconsola, ensuring the logger is created with proper default reporters.https://github.com/unjs/consola/blob/512d570b3f99a27b6766a885cae2730aa3dc0ed4/src/index.ts#L17-L42
@dulnan