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
Closed
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
8 changes: 5 additions & 3 deletions packages/vite/src/node/server/transformRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ async function loadAndTransform(

code = code.replace(convertSourceMap.mapFileCommentRegex, blankReplacer)
} catch (e) {
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

logger.warn(`Failed to load source map for ${url}.`, {
timestamp: true,
})
}
}
}
} else {
Expand Down