question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

umd module compiler option doesn't have a fallback for global namespace.

See original GitHub issue

Most 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:open
  • Created 7 years ago
  • Reactions:81
  • Comments:39 (13 by maintainers)

github_iconTop GitHub Comments

15reactions
njleonzhangcommented, Aug 9, 2018

If the umd module can not support global variable, why typescript call it umd? So I suggest remove this option if it can not support.

14reactions
njleonzhangcommented, Aug 10, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found