Handle file paths that start with file://#3841
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds handling for file URLs (paths starting with file://) in the plugin resolution logic. The change prevents the extension from attempting to resolve file:// URLs as node modules, treating them similarly to relative paths (starting with .) and absolute paths.
Key Changes:
- Modified
resolveConfigPluginsto skip node module resolution for plugin paths starting withfile://
| !path.isAbsolute(plugin) && | ||
| !plugin.startsWith("file://") |
There was a problem hiding this comment.
The new condition to skip module resolution for file:// URLs lacks test coverage. Consider adding a test case in src/test/suite/plugins.test.ts or creating a new test fixture that includes a plugin path starting with file:// to ensure this behavior is properly tested and doesn't regress in the future.
| !plugin.startsWith(".") && | ||
| !path.isAbsolute(plugin) | ||
| !path.isAbsolute(plugin) && | ||
| !plugin.startsWith("file://") |
There was a problem hiding this comment.
The check !plugin.startsWith("file://") is case-sensitive. While URL schemes are typically lowercase, RFC 3986 specifies that schemes are case-insensitive. Consider using !plugin.toLowerCase().startsWith("file://") to handle edge cases like FILE:// or File://.
| !plugin.startsWith("file://") | |
| !plugin.toLowerCase().startsWith("file://") |
Supersedes #3803