-
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 plugin loading to cope with modules that have immutable exports #5520
Conversation
…es (resolves #5514) Signed-off-by: Simon Stone <[email protected]>
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.
thanks @sstone1 👍
@evidolob please could you review this PR? |
@sstone1 How can one verify it? Do you have an extension to test? |
@akosyakov I've tested it locally with our IBM Blockchain Platform extension - here's the Che plugin configuration I've been using: https://gist.githubusercontent.com/sstone1/2882d58638838914f3a4cabf67b50df1/raw/1c1e60d3299fffdb785b586afc530054cf5b024a/meta.yaml Our extension pulls in modules with immutable exports (ansi-styles) and native modules (grpc). The behaviour I observed before the fix is that the extension loads once inside Che, and then when you F5 - it will not load again. FYI - don't use the extension version from the VSCode marketplace - it won't work inside Che. |
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.
Although i found #5626 |
Fixes #5514
Some node modules, such as ansi-styles, define the
exports
property in an immutable manner: https://github.com/chalk/ansi-styles/blob/master/index.js#L159Because the
exports
property has no setter, it throws an error when we try to overwrite it. We can just delete it instead.Also, you cannot reload native modules - an error is thrown when you attempt to do so:
... so I've also fixed the code to skip doing anything with native modules (which have an ID that ends with
.node
).