-
Notifications
You must be signed in to change notification settings - Fork 235
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
Support CommonJS #301
Comments
Could you provide more details so we can better understand you scenario? |
Where AMD loader is not available, the library should fall-back to CommonJS. Something like this (or switch to a cross-compatible format like UMD) |
Thank you, I'll look into this in the next sprint. |
Any updates here? |
@KamilSzostak ? :) |
I apologize for the delay. I'll do my best to look into this item next week. |
I took a closer look at CommonJS support. TypeScript compiler allows to choose a module loading standards: AMD or CommonJS (see Unfortunately, for CommonJS it doesn't support combining external modules and it's not possible to merge all output *.js files into one file. Could you explain your scenario a bit better? If your code is running on a server side, it might be OK if JS SDK files are not combined. If your code is running in the browser, AMD seems like a better choice. |
The main idea is to support es6 modules (import/export). An added advantage is that this library does not pollute to global scope when using a module loader (like webpack or systemjs). You can wrap the dist code inside an umd wrapper.(https://github.com/umdjs/umd/blob/master/templates/returnExports.js#L41) Thereby supporting both commonJs, AMD and window. |
Any update on this? |
This Babel plugin can be useful as a workaround: babel-plugin-transform-amd-to-commonjs. |
v2 sdk uses es6 modules for npm consumption and umd modules for CDN consumption. This should hopefully resolve all compatibility issues for now! |
Cool, thanks @markwolff, I'll try it. |
@pviotti Correct, that is the v2 version. There is no changelog yet since it is still in a beta stage, but it is meant to keep the same overall functionality as v1. Most of the differences are at the API layer, e.g arguments were switched to objects instead of positional ones. Since typings are included, intellisense should help with that. If you do run into issues, please do let me know! |
@markwolff Is there a roadmap for v2? Expected "gold" date? Trying to plan a new implementation of AppInsights and don't want to use the old one just to be replaced soon |
@tommck Most likely January |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.
The text was updated successfully, but these errors were encountered: