-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(vite): allow overriding vite sourcemap #7342
Conversation
β Deploy Preview for nuxt3-docs canceled.
|
This might be a breaking change but having multiple sources of trust is probably more dangerous to introduce such cases. Any reason we can't rely on one top level |
I think issue is that vite allows multiple kinds of sourcemaps. e.g. 'hidden' or 'inline'. |
I see. It is same for webpack too actually. I was going to suggest in initial refactor to extend boolean to other string values per type. But in this case, for now it can be enabled with top level sourcemap.client (it is a breaking change) and keep using vite config until we can do that. I don't think implicitly auto enabling client sourcemap was right behavior. |
I'm not sure I understand what you are suggesting. What do you mean by "implicitly auto enabling client sourcemap"? What are you saying the problem is with the previous PR? |
No i mean changes with previous PR was right (we just forgot to mark it as breaking change). Before PR, setting |
packages/vite/src/client.ts
Outdated
@@ -51,7 +51,7 @@ export async function buildClient (ctx: ViteBuildContext) { | |||
dedupe: ['vue'] | |||
}, | |||
build: { | |||
sourcemap: ctx.nuxt.options.sourcemap.client, | |||
sourcemap: ctx.config.build?.sourcemap ?? ctx.nuxt.options.sourcemap.client, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be reversed. options.sourcemap.client? config.build.sourcemap : false
this way we both respect enabling flags and vite configuration for type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice solution!
π Linked issue
resolves nuxt/nuxt#14840
β Type of change
π Description
Since we started setting sourcemap per-client, per-server, we are overriding the user's choice if they have configured this manually, which they may wish to do.
This respects the value of
vite.build.sourcemap
if set.π Checklist