Skip to content

Commit

Permalink
fix: fix watcher unlink listener setup timing
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 19, 2023
1 parent e9bc807 commit 2d2c91a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,16 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {

configureServer(server) {
options.devServer = server
if (options.compiler.invalidateTypeCache) {
server.watcher.on('unlink', (file) => {
options.compiler.invalidateTypeCache(file)
})
}
},

buildStart() {
options.compiler = options.compiler || resolveCompiler(options.root)
const compiler = (options.compiler =
options.compiler || resolveCompiler(options.root))
if (compiler.invalidateTypeCache) {
options.devServer?.watcher.on('unlink', (file) => {
compiler.invalidateTypeCache(file)
})
}
},

async resolveId(id) {
Expand Down

0 comments on commit 2d2c91a

Please sign in to comment.