Skip to content
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

UMD should always immediately run factory #82

Open
zhdanovme opened this issue Jun 30, 2016 · 1 comment
Open

UMD should always immediately run factory #82

zhdanovme opened this issue Jun 30, 2016 · 1 comment

Comments

@zhdanovme
Copy link

zhdanovme commented Jun 30, 2016

i've got es5-shim with UMD, and synchronous inline script which uses this shim (it must be synchronous due to block html parsing) but require.js resolve es5shim dependency asynchronous, and inline script rise an error, because inline-script run before require(['es5-shim']) is done.

So UMD in case of such libraries, should always immediately run factory and exports for AMD its value;

also there is one more example why it should always immediately run factory, #78

@zhdanovme zhdanovme changed the title Should UMD should always immediately run factory Jun 30, 2016
@3cp
Copy link

3cp commented Oct 3, 2018

jquery is in UMD format, but it runs factory func and set global $ and jQuery variable immediately, before any module requiring it.

So if you prepare the UMD output for a package, you can do it.
Since you probably have no control of es5-shim package, just load it using script tag BEFORE requirejs (or other AMD implementation). So that es5-shim's UMD code can do what it is designed to do: use global name space when AMD env is not available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants