-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore ability to load plugins from relative URL #2563
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2563 +/- ##
==========================================
- Coverage 60.86% 60.86% -0.01%
==========================================
Files 547 547
Lines 25727 25734 +7
Branches 6078 6076 -2
==========================================
+ Hits 15659 15663 +4
- Misses 9743 9746 +3
Partials 325 325
Continue to review full report at Codecov.
|
packages/core/PluginLoader.ts
Outdated
) | ||
} catch (error) { | ||
console.error(`Error parsing URL: ${pluginDefinition.cjsUrl}`) | ||
throw error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
throw new Error(`Error parsing URL: ${pluginDefinition.cjsUrl}`)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that, but wanted to keep the original error in case it had any relevant information. I guess that's not likely, though, so maybe I can log the original error and then throw the custom error since that's what users will see in the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes #2562
This passes the window location as a second argument to the URL constructor. If a plugin definition has a full URL, the second argument gets ignored, but if a plugin definition has a relative URL it is resolved relative to the window location. Examples of how the resolution works are here.
It also logs an error message with the name of the failed URL since that's not included in the native error message.