-
Notifications
You must be signed in to change notification settings - Fork 712
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
Inversify doesn't work well when reflect-metadata is loaded again #737
Comments
Hi @DonJayamanne, I think this issue should be fixed by the The problem is somewhere in https://github.com/rbuckton/reflect-metadata/blob/master/Reflect.ts#L1697-L1715 Many people have already reported similar issues: rbuckton/reflect-metadata#78 But the module seems to not be actively maintained 😢 The module has been created by one of the TypeScript engineers at Microsoft. Since you guys work at vscode maybe you can contact him through Microsoft? The |
@remojansen Thanks for the response, I'll ping @rbuckton. Is it possible for At the end of the day |
Hi @DonJayamanne about:
This feature is not avaiable righ now but I started to work on it last night. I will provide you with an interface to read and write metadata. The default implementation of the interface will use About:
This is true, but only for a period of time. In theory, in the future |
@DonJayamanne I was trying to fix this issue in InversifyJS but after a few hours, I realized that there is not much that I can do. It needs to be fixed in the This is something that needs to be addressed by the polyfill authors it should not have to be addressed by the lib authors or the vscode extension authors. The other option would be that vscode could use isolated globals for each extension. That way extension and library authors would not have to worry but I don't know if this is an option. I have created an issue to ask for this microsoft/vscode#41297 |
This should now be fixed in |
Thanks a lot for the fix and release @rbuckton 👍 |
@DonJayamanne I'm closing this issue. Thanks a lot for using InversifyJS 😄 |
I am hoping @remojansen & @rbuckton may be able to provide some insight here... For one of our front-end projects we are currently using InversifyJS as well as Aurelia and Webpack 3 (via aurelia/webpack-plugin and aurelia/bootstrapper) The issue described above with I believe the recommended usage for the Aurelia webpack-plugin is to pair it with either the aurelia/bootstrapper or aurelia/bootstrapper-webpack module as the entry point being Unfortunately, the Aurelia bootstrapper(s) will first load aurelia/polyfills which includes a Reflection API implementation. For some reason, this implementation was causing the InversifyJS Since the Aurelia Reflect polyfill always got "clobbered" by our initial I realize this is more of an issue with the Aurelia bootstrapping code for Webpack rather than InversifyJS or even reflect-metadata, but i still wanted to point out that the change in behavior could have adverse effects on users of InversifyJS / Aurelia / Webpack if they actually WANT reflect-metadata to override other polyfills. |
I understand that
reflelect-metadata
needs to be loaded once per application. However I'd like to bring this up once again and hope we could somehow find a work around for this.Recently our VS Code Python Extension for Visual Studio Code stopped working because another extension was loading
reflect-metadata
unconditionally. As our extension is used by a million users, this was a fairly serious issue. We (both VS Code extensions) have adopted the solution of conditionally importingreflect-metadata
.However this doesn't prevent others from creating extensions that directly or indirectly load
reflect-metadata
. E.g. other IOC libraries such as typescript-ioc loadreflect-metadata
regardless.microsoft/vscode-python#432
Is there any other solution to this, or alternative to
reflect-metadata
?The text was updated successfully, but these errors were encountered: