Feature Proposal: Remote as an Object#7
Feature Proposal: Remote as an Object#7schirrel wants to merge 4 commits intomodule-federation:mainfrom
Conversation
|
when you had the time, please take a loook @ScriptedAlchemy @jacob-ebey 🙏🏻 |
| }; | ||
|
|
||
| const dynamicRemote = (remote) => { | ||
| return `(resolve) => { |
There was a problem hiding this comment.
we should use webpack require.l for script loading here. i opened a PR adding webpack runtime requirements to promise based remotes
There was a problem hiding this comment.
We should so this instead
new Promise(function(resolve, reject) {
var __webpack_error__ = new Error();
if (typeof window.${
containerWithAtSyntax[0]
} !== 'undefined') return resolve();
var containerUrl = ${containerWithAtSyntax[1]} ?
'${containerWithAtSyntax[1]}' : remoteConfig.entry
__webpack_require__.l(
containerUrl,
function(event) {
if (typeof window.${
containerWithAtSyntax[0]
} !== 'undefined') return resolve();
var errorType = event && (event.type === 'load' ? 'missing' : event.type);
var realSrc = event && event.target && event.target.src;
__webpack_error__.message =
'Loading script failed.\\n(' + errorType + ': ' + realSrc + ')';
__webpack_error__.name = 'ScriptExternalLoadError';
__webpack_error__.type = errorType;
__webpack_error__.request = realSrc;
reject(__webpack_error__);
},
'${containerWithAtSyntax[0]}',
);
})
]).then(function(){
res(window.${containerWithAtSyntax[0]})
});
|
Im unsure why you want to add an async: true? Is this purely so that the promise string can be hidden from the user and instead we create the factory for returning promise new promise? Just want to understand what/how this would be a good method for taking away the ability to call promise new promise on your own out the box. In its current form it looks like promise new promise just does what the @ syntax would, but as a custom promise without any ability to add additional things onto that promise new promise string. correct? |
|
hey @ScriptedAlchemy the reason for
About the |
…-remote-as-object-async
|
I've tried to use BTW the code on this PR also allow the default behavior of |
Can be seen as a simplification of the middleware.
Provides an options to pass the remote values as an object that can:
also fixed the name on the file, sorry for that 😅