-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix frontend use of Uri.joinPath with path-browserify #10745
Conversation
Signed-off-by: robmor01 <[email protected]>
@thegecko the automated IP Due Diligence check passed with the new dependency, it should be good to use 👍 |
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.
@thegecko from the browsersify/path-browser
documentation it states that:
You usually do not have to install path-browserify yourself! If your code runs in Node.js, path is built in. If your code runs in the browser, bundlers like browserify or webpack include the path-browserify module by default.
Is the change still necessary, is it not handled by webpack?
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.
Infact it looks like it might be necessary based on the webpack documentation.
I confirmed that the joinPath
works in web extensions:
@thegecko I remembered that we had a small implementation of Would that suffice or is it better to use the full npm polyfill? Just trying to figure out if we have redundancy here. |
Yeah, webpack 5 no longer bundles the polyfills
Hmm, this may work for the 2 functions defined, but there may be other path functions/cases in future. Personally I'd rather rely on the recommended polyfill. Will merge for now, but happy to revisit using the leaner path implementation in a future PR. |
Signed-off-by: robmor01 <[email protected]>
Signed-off-by: robmor01 <[email protected]> Signed-off-by: Federico Bozzini <[email protected]>
Signed-off-by: robmor01 [email protected]
What it does
Using
vscode.Uri.joinPath()
ortheia.Uri.joinPath()
in frontend modules (Theia frontend plugins or VS Code Web Extensions) was failing becausepath
was not found:This PR adds the
path-browserify
polyfill to fix the issue.Note, a new dependency has been added which uses the MIT license, does this need to be tracked or signed off?
path-browserify
How to test
Create a frontend module which calls
Uri.joinPath()
Review checklist
Reminder for reviewers