-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature Proposal: Remote as an Object #7
base: main
Are you sure you want to change the base?
Feature Proposal: Remote as an Object #7
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 😅