Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): only warn sourcemap in loadTransform when explicitly turned on #15709

Closed
wants to merge 1 commit into from

Conversation

antfu
Copy link
Member

@antfu antfu commented Jan 24, 2024

Description

We got quite some warnings regarding sourcemap when we never need them, and it seems there is no way to disable it:

image

This kind of warning is generally useless but quite annoying to the end users. I think it make more sense only to warn when sourcemap is enabled.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines, especially the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Update the corresponding documentation if needed.
  • Ideally, include relevant tests that fail without this PR but pass with it.

Copy link

stackblitz bot commented Jan 24, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

logger.warn(`Failed to load source map for ${url}.`, {
timestamp: true,
})
if (server.config.build.sourcemap) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think config.build.sourcemap only applies during build. Is there actually a way to disable sourcemaps during dev?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think dev has an option, it's always implied to be enabled. I'm not really sure if we need an option, or use this build option though. It seems like a helpful warning, but if not you could use customLogger to filter it out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. But I still think it might be better to maybe have an dev option to disable the warning. CustomLogger would do for Vite users, but it could be hard for the meta framework to do so.

Either way let's fix the upstream issue first: inikulin/parse5#831

@bluwy
Copy link
Member

bluwy commented May 18, 2024

@antfu are you still interested in pushing forward this PR? I had update the warning in #16170 to print the entire error instead, and I usually find actual configuration error that should be fixed instead of hiding.

@bluwy
Copy link
Member

bluwy commented Jul 24, 2024

I'll close this for now as the updated warning should be more helpful now.

@bluwy bluwy closed this Jul 24, 2024
@bluwy bluwy deleted the fix/sourcemap-warn branch July 24, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants