diff options
author | 2023-05-06 16:32:06 -0700 | |
---|---|---|
committer | 2023-05-06 16:32:06 -0700 | |
commit | 46a0a4d984b8c679b30dff1485584fd29269e1c3 (patch) | |
tree | 2b305652ac559c717f438c431cc41a649d0167c1 /src/bun.js/builtins/js | |
parent | 70e850bf76ee9e2124a95e865208aa6e63fa3538 (diff) | |
download | bun-46a0a4d984b8c679b30dff1485584fd29269e1c3.tar.gz bun-46a0a4d984b8c679b30dff1485584fd29269e1c3.tar.zst bun-46a0a4d984b8c679b30dff1485584fd29269e1c3.zip |
[Bun.build] Add error when an `onResolve` plugin returns a `namespace` which has no loader
Diffstat (limited to 'src/bun.js/builtins/js')
-rw-r--r-- | src/bun.js/builtins/js/BundlerPlugin.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bun.js/builtins/js/BundlerPlugin.js b/src/bun.js/builtins/js/BundlerPlugin.js index f580a1c05..64c655bbe 100644 --- a/src/bun.js/builtins/js/BundlerPlugin.js +++ b/src/bun.js/builtins/js/BundlerPlugin.js @@ -136,6 +136,13 @@ function runOnResolvePlugins( ); } } + + if (userNamespace && userNamespace !== "file" && (!onLoad || !onLoad.@has(userNamespace))) { + @throwTypeError( + `Expected onLoad plugin for namespace ${@jsonStringify(userNamespace, " ")} to exist` + ); + } + } this.onResolveAsync(internalID, path, userNamespace, external); return null; |