Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita288c96

Browse files
authored
Merge pull request#14 from code-found/bugfix/context-null-error
Bugfix/context null error
2 parents9478090 +46694bc commita288c96

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

‎.changeset/lemon-heads-turn.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"rts.js":patch
3+
---
4+
Fixed
5+
- resolver: handle null resolve context to avoid crash on Node 18
6+
- Guard destructuring with`context || {}` to prevent runtime error when`context` is null.
7+
- Affects:`src/resolver/index.ts`
8+
- Environment: reproducible on macOS with Node 18; Windows with Node 23 unaffected.

‎src/resolver/index.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,16 @@ export class ModuleResolver extends ModuleTransformer {
226226
specifier:string,
227227
context:ResolveHookContext,
228228
):{url?:string}{
229-
const{ parentURL=""}=context;
229+
/**
230+
* bugfix: fix the bug that context is null on node 18.
231+
*
232+
* on node 18,context will be null.
233+
* not very clear know if only node 18 is like this.
234+
* on my windows with node 23 it sis ok.
235+
* but on mac with node 18 the bug come out.
236+
*
237+
*/
238+
const{ parentURL=""}=context||{};
230239
constcacheKey=`${specifier}:${parentURL}`;
231240
leturl=this.cache.get(cacheKey);
232241

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp