Skip to content

Commit 8204fce

Browse files
committed
fix(plugin-vue): always transform cached modules in build watch mode
1 parent 7288a59 commit 8204fce

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: packages/plugin-vue/src/index.ts

+13
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

@@ -277,6 +279,17 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
277279
!config.isProduction
278280
),
279281
}
282+
transformCachedModule =
283+
config.command === 'build' &&
284+
options.value.sourceMap &&
285+
config.build.watch != null
286+
},
287+
288+
shouldTransformCachedModule({ id }) {
289+
if (transformCachedModule && parseVueRequest(id).query.vue) {
290+
return true
291+
}
292+
return false
280293
},
281294

282295
configureServer(server) {

0 commit comments

Comments
 (0)