0
私はpromise-polyfill
上ラッパーモジュールを持っている - そして、私はすべての私のモジュールに注入ProvidePluginから提供されたモジュールのコンテキストを設定するには?
/* jshint node: true */
/* global Promise: false */
"use strict";
if (typeof Promise === "undefined") {
module.exports = require('promise-polyfill');
} else {
module.exports = Promise;
}
:
new webpack.ProvidePlugin({
'Promise': 'require-promise',
})
と私は問題を取得。 Promise
は空のオブジェクトで、代わりにネイティブPromise
またはundefined
です。どのように私はこのモジュールに文脈(window
またはglobal
)を渡すことができますか?
function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Promise) {/*** IMPORTS FROM imports-loader ***/
(function() {
/* jshint node: true */
/* global Promise: false */
"use strict";
console.log(Promise);
if (typeof Promise === "undefined") {
module.exports = __webpack_require__(59);
} else {
module.exports = Promise;
}
/*** EXPORTS FROM exports-loader ***/
module.exports = Promise;
}.call(window));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
/***/ },
? 'Promise'は' {} 'としてターンダウンしていますか? – Rohit416
はい。私は生成されたコード –
で答えを更新し、 'console.log(Promise)'に出力しました....? – Rohit416