然后每次我运行恒星 localhost 我都会得到错误stellar-wallet#undefined
。
我认为它与
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr)
异步函数中的所有参数有关,但它仍然无法识别。如果您在某个地方找到解释所有论点的文档,那将会很有帮助。
这是整个代码
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
// initializeComponent
if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) && (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
if (Cstr.then) {
// Await creates a micro-task avoid if possible
const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
Cstr = await Cstr;
endLoad();
}
console.log(BUILD.isDev);
console.log(BUILD.isDebug);
console.log(!Cstr);
if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
}
if (BUILD.member && !Cstr.isProxied) {
// we'eve never proxied this Constructor before
// let's add the getters/setters to its prototype before
// the first time we create an instance of the implementation
if (BUILD.watchCallback) {
cmpMeta.$watchers$ = Cstr.watchers;
}
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
if (BUILD.member) {
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
if (BUILD.member) {
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
if (BUILD.watchCallback) {
hostRef.$flags$ |= 128 /* isWatchReady */;
}
endNewInstance();
fireConnectedCallback(hostRef.$lazyInstance$);
}
else {
// sync constructor component
Cstr = elm.constructor;
hostRef.$flags$ |= 128 /* isWatchReady */ | 32 /* hasInitializedComponent */;
}
if (BUILD.style && Cstr.style) {
// this component has styles but we haven't registered them yet
let style = Cstr.style;
if (BUILD.mode && typeof style !== 'string') {
style = style[(hostRef.$modeName$ = computeMode(elm))];
if (BUILD.hydrateServerSide && hostRef.$modeName$) {
elm.setAttribute('s-mode', hostRef.$modeName$);
}
}
const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
if (!styles.has(scopeId)) {
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
style = await import('./shadow-css-3ef739e8.js').then(m => m.scopeCss(style, scopeId, false));
}
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
}
}
}
// we've successfully created a lazy instance
const ancestorComponent = hostRef.$ancestorComponent$;
const schedule = () => scheduleUpdate(hostRef, true);
if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
// this is the intial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
};