Skip to content

Commit

Permalink
fix(plugin-vue): always transform cached modules in build watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Jan 14, 2025
1 parent 7288a59 commit 8204fce
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
: createFilter(customElement)
})

let transformCachedModule = false

return {
name: 'vite:vue',

Expand Down Expand Up @@ -277,6 +279,17 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
!config.isProduction
),
}
transformCachedModule =
config.command === 'build' &&
options.value.sourceMap &&
config.build.watch != null
},

shouldTransformCachedModule({ id }) {
if (transformCachedModule && parseVueRequest(id).query.vue) {
return true
}
return false
},

configureServer(server) {
Expand Down

0 comments on commit 8204fce

Please sign in to comment.