Skip to content

Commit

Permalink
fix: nullable runner
Browse files Browse the repository at this point in the history
closes #21
  • Loading branch information
sxzz committed Dec 28, 2023
1 parent 2a3045f commit 6563224
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default createUnplugin<Options | undefined, false>((rawOptions = {}) => {
let externalServer: boolean
let server: ViteDevServer
let node: ViteNodeServer
let runner: ViteNodeRunner
let runner: ViteNodeRunner | undefined

const deps: Map<string, Set<string>> = new Map()

Expand Down Expand Up @@ -73,7 +73,7 @@ export default createUnplugin<Options | undefined, false>((rawOptions = {}) => {

async function getRunner() {
await init()
return runner
return runner!
}

const name = 'unplugin-macros'
Expand Down Expand Up @@ -103,6 +103,7 @@ export default createUnplugin<Options | undefined, false>((rawOptions = {}) => {
},

handleHotUpdate({ file, server, modules }) {
if (!runner) return
const cache = runner.moduleCache
const mod = cache.get(file)
if (!mod) return
Expand Down

0 comments on commit 6563224

Please sign in to comment.