Skip to content

Commit

Permalink
fix: use optional chaining for accessing importAttributes
Browse files Browse the repository at this point in the history
otherwise Node 20.x will fail since it has been introduced after
  • Loading branch information
Julien-R44 committed May 1, 2024
1 parent 2fc1a95 commit 12d4a2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/hot_hook/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class HotHookLoader {
url = parsedUrl.href
}

if (context.importAttributes.hot) {
if (context.importAttributes?.hot) {
delete context.importAttributes.hot
}

Expand Down Expand Up @@ -183,7 +183,7 @@ export class HotHookLoader {
} else {
const parentPath = fileURLToPath(parentUrl)
const isHardcodedBoundary = this.#hardcodedBoundaryMatcher.match(resultPath)
const reloadable = context.importAttributes.hot === 'true' ? true : isHardcodedBoundary
const reloadable = context.importAttributes?.hot === 'true' ? true : isHardcodedBoundary

this.#dependencyTree.addDependency(parentPath, { path: resultPath, reloadable })
}
Expand Down

0 comments on commit 12d4a2b

Please sign in to comment.