umd module compiler option doesn't have a fallback for global namespace.
See original GitHub issueMost umd patterns have a third fallback that allows exporting to the window.namesapace = export; As such the current umd module export is pretty broken when a huge number of users / library developers need to support all three.
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory(require, exports, module);
} else {
root.exceptionless = factory();
}
}(this, function(require, exports, module) {}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:81
- Comments:39 (13 by maintainers)
Top Results From Across the Web
UMD syntax with fallback global - Stack Overflow
I'm compiling my .ts module 'FooModule' into an UMD module in Visual Studio 2015. I would like to extend this UMD syntax, so...
Read more >TSConfig Reference - Docs on every TSConfig option
When set to true, allowUmdGlobalAccess lets you access UMD exports as globals from inside module files. A module file is a file that...
Read more >Overview - TypeScript
JavaScript has a lot of different module syntaxes or conventions: the one in the ... In TypeScript 3.5, you can now reference UMD...
Read more >Understanding TypeScript's “Compilation Process” & the ...
json file using --project or -p command-line flag. This file doesn't need to have the tsconfig.json filename if you are using this flag...
Read more >Understanding (all) JavaScript module formats and tools
UMD module : Universal Module Definition, or UmdJS module ... TypeScript module and namespace can have multiple levels by supporting the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If the
umd
module can not support global variable, why typescript call itumd
? So I suggest remove this option if it can not support.@kitsonk Although I have some words to refute you, I shut up at this time to avoid meaningless argument in this thread. I just want
typescript
to fix this, or if you really want to keep it, at least document it explicitly. The UMD, as a convention, usually supports global variable. current situation really makes users confused.