-
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
[plugin] module resolution needs to be fully qualified #8018
Comments
Ideally the plugin host process should not import anything from |
Of course, I was using this as an example :)
Oh, so the issue I've outlined is only apparent when importing I'd like to understand why so that this issue can be avoided for other packages, perhaps it should be documented? |
Oh, you mean that if I install any npm package as a dependency which provides index.js file then it cannot be imported? That's definitely will be a bug.
I meant that it is not possible to access anything from |
I haven't tried, but can't se it will be any different. My example above only differs in the way things are exported.
Yeah, I would expect the same, independent classes and/or global functions and types should still work, though. |
I have got to the bottom of this issue. Inversify requires In this case, I would expect the plugin which failed to start to exit the entire app just as if this error was raised in the main process. Therefore, what do people think of crashing the entire application if key plugins fail to start? This could be implemented for development only using a flag or switch or alternatively, key plugins could be marked as required to start for a clean startup. |
🙈 It would be good to have a linting rule which restricts dependencies between js modules. VS Code codebase has custom: https://github.com/microsoft/vscode/blob/master/.eslintrc.json#L90 We could adopt it. Additionally we discussed with Sven long time ago to get rid of all index files since they tend to pull everything. |
We catch the error without propagating to the activation: theia/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts Lines 198 to 200 in 7877a55
|
I don't see that catch block hit in this case. This is where the error is swallowed:
|
@thegecko this catch can be removed and theia/packages/plugin-ext/src/plugin/plugin-manager.ts Lines 366 to 373 in 3eb0678
PluginManagerExtImpl.loadPlugin as well.
|
Bug Description:
TypeScript modules can be exported from index files to make it easier for importing.
For example, this file exports
file-uri
so that it can be imported like this:However, plugins in the plugin system don't seem to resolve modules exported in this manner and have to be fully qualified, e,g,:
This would be fine if the build fails, however in this case the plugin correctly builds, but fails to load without any error. This situation is prone to lead to some difficult issues to debug.
I would expect either:
or
Steps to Reproduce:
A repo with a theia plugin outlining the issue is here:
https://github.com/thegecko/theia-plugin
Build this and include it in the plugins when launching Theia. Use these lines to switch between the plugin working and not.
The plugin code to reproduce is short:
Additional Information
cc @benoitf Have you seen this issue when writing che plugins?
The text was updated successfully, but these errors were encountered: