Skip to content

Commit 906cebb

Browse files
authoredMar 17, 2025··
fix(plugin-vue): resolve sourcemap conflicts in build watch mode with cached modules (#505)
1 parent 2704e85 commit 906cebb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed
 

‎packages/plugin-vue/src/index.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
201201
: createFilter(customElement)
202202
})
203203

204+
let transformCachedModule = false
205+
204206
return {
205207
name: 'vite:vue',
206208

@@ -294,7 +296,6 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
294296
!config.isProduction
295297
),
296298
}
297-
298299
// #507 suppress warnings for non-recognized pseudo selectors from lightningcss
299300
const _warn = config.logger.warn
300301
config.logger.warn = (...args) => {
@@ -308,6 +309,18 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
308309
}
309310
_warn(...args)
310311
}
312+
313+
transformCachedModule =
314+
config.command === 'build' &&
315+
options.value.sourceMap &&
316+
config.build.watch != null
317+
},
318+
319+
shouldTransformCachedModule({ id }) {
320+
if (transformCachedModule && parseVueRequest(id).query.vue) {
321+
return true
322+
}
323+
return false
311324
},
312325

313326
configureServer(server) {

0 commit comments

Comments
 (0)
Please sign in to comment.