Skip to content

Commit 906cebb

Browse files
authored
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

Lines changed: 14 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy