Skip to content

Commit 5bcda75

Browse files
refactor: handle module assignment fallback in RNodeRuntime constuctor
1 parent ec1fba8 commit 5bcda75

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/runtime/Instance/RNodeRuntime.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ export class RNodeRuntime extends RNode {
2727

2828
/** @type {LoadSvelteModule} */
2929
this.asyncModule = asyncModule
30+
31+
if (!this.module) {
32+
this.module = NoopModule
33+
this.meta.isNoop = true
34+
}
3035
}
3136

3237
// TODO DEPRECATE
@@ -62,6 +67,7 @@ export class RNodeRuntime extends RNode {
6267
return !!(this.module || this.asyncModule)
6368
}
6469

70+
// todo deprecate - not used
6571
/** @ts-ignore SvelteComponentConstructor is only available in VSCode */
6672
/** @returns {Promise<SvelteComponentDev>} */
6773
async getRawComponent() {
@@ -85,9 +91,7 @@ export class RNodeRuntime extends RNode {
8591
* @returns {Promise<ReservedCmpProps|undefined> | ReservedCmpProps | undefined }
8692
*/
8793
loadModule() {
88-
if (!this.module && !this.asyncModule) this.module = NoopModule
89-
if (!this.module && this.asyncModule) return this.asyncLoadModule()
90-
return /** @type {ReservedCmpProps} */ (this.module)
94+
return /** @type {ReservedCmpProps} */ (this.module || this.asyncLoadModule())
9195
}
9296

9397
/**

0 commit comments

Comments
 (0)