Skip to content

Commit

Permalink
Merge pull request #228 from chuckdumont/work
Browse files Browse the repository at this point in the history
Fix Promise not defined exception on IE9
  • Loading branch information
chuckdumont authored Mar 29, 2019
2 parents aaeb4a0 + e56b7b1 commit f4048eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<p>Build Dojo 1.x applications with webpack<p>
</div>

<!-- TOC START min:1 max:3 link:true update:true -->
<!-- TOC START min:1 max:3 link:true asterisk:false update:true -->
- [Introduction](#introduction)
- [The Dojo loader](#the-dojo-loader)
- [CommonJS require vs. Dojo synchronous require](#commonjs-require-vs-dojo-synchronous-require)
Expand Down Expand Up @@ -50,7 +50,6 @@
- [Release Notes](#release-notes)
- [Known Issues](#known-issues)
- [Footnotes](#footnotes)

<!-- TOC END -->

# Introduction
Expand Down Expand Up @@ -255,6 +254,8 @@ Promise.resolve(require('myAmdModule')).then(function(myAmdModule) {
});
```

Because async mode depends on ES6 Promise, you need to provide a polyfill on platforms that don't support Promise natively (e.g. IE9). Note that the amd/dojoES6Promise polyfill provided by this package cannot be used for this purpose because the AMD modules that implement the polyfill (dojo/Deferred, etc.) cannot be loaded without the Promise support.

##### Wrapped promises

This section is for the special (and hopefully rare) case of requiring, from CommonJS code, an AMD module that itself returns a promise as the module value. If you're not doing this in your code, then you can ignore this section.
Expand Down
2 changes: 1 addition & 1 deletion runtime/DojoAMDMainTemplate.runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = {
return id && __webpack_require__(id) || undefined;
}
var has = findModule("dojo/has", null, true);
if (has instanceof Promise) {
if (typeof has.then === 'function') {
var newPromise = has.then(function(has) { return resolve(has); }); // eslint-disable-line no-shadow
newPromise.__DOJO_WEBPACK_DEFINE_PROMISE__ = true;
return newPromise;
Expand Down

0 comments on commit f4048eb

Please sign in to comment.