Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ccadd3

Browse files
committed
fix: resolve sourcemap conflicts in build watch mode with cached modules
ref vitejs/vite-plugin-vue@906cebb
1 parent 2abcc7c commit 6ccadd3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/core/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ export const plugin: UnpluginInstance<Options | undefined, false> =
238238
version,
239239
}
240240

241+
let transformCachedModule = false
242+
241243
return {
242244
name: 'unplugin-vue',
243245

@@ -340,6 +342,18 @@ export const plugin: UnpluginInstance<Options | undefined, false> =
340342
}
341343
_warn(...args)
342344
}
345+
346+
transformCachedModule =
347+
config.command === 'build' &&
348+
options.value.sourceMap &&
349+
config.build.watch != null
350+
},
351+
352+
shouldTransformCachedModule({ id }) {
353+
if (transformCachedModule && parseVueRequest(id).query.vue) {
354+
return true
355+
}
356+
return false
343357
},
344358

345359
configureServer(server) {

0 commit comments

Comments
 (0)