Skip to content

Vite plugin logging to stdout instead of stderr #551

Closed
@brynary

Description

@brynary

Environment

Vite, Remix

Steps to Reproduce

  1. Install @sentry/vite-plugin to send source maps and release notifications from CI/CD to Sentry
  2. Intentionally do not store a Sentry auth token locally, only on CI/CD
  3. Install Knip, a tool to find unused code
  4. Run Knip with npx knip --reporter json | jq .

Expected Result

Knip writes valid JSON to stdout. Any output from Knip would go to stderr not stdout because it is not the primary output of the execution.

Actual Result

Sentry sends the following warning to stdout:

[sentry-vite-plugin] Warning: No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/

As a result of this warning going to stdout, the output from knip is invalid JSON.

Thoughts

  • I am operating under the assumption that it is reasonable for us to only use a Sentry token in CI/CD, and not use one locally. Is that reasonable?
  • Perhaps there is a way to explicitly tell the Vite plugin that it should not be trying to upload source maps, so it can understand there is no need for the warning
  • Given that there are any number of log lines / warnings that the vite plugin could potentially emit, could the vite plugin logger be set to log to stderr instead of stdout?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions