Skip to content

Commit 8a41ecd

Browse files
committed
make conditionals less error prone
1 parent 170e5ee commit 8a41ecd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/common/src/sandbox/modules.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ export const findMainModule = (sandbox?: Sandbox) => {
255255

256256
// first attempt: try loading the entry file if it exists
257257
const entryModule = resolve(sandbox.entry);
258-
if (entryModule) return entryModule;
258+
if (entryModule) {
259+
return entryModule;
260+
}
259261

260262
// second attempt: try loading the first file that exists from
261263
// the list of possible defaults in the template defination
@@ -276,7 +278,9 @@ export const findMainModule = (sandbox?: Sandbox) => {
276278
.map(path => resolve(path))
277279
.find(module => module);
278280

279-
if (defaultOpenModule) return defaultOpenModule;
281+
if (defaultOpenModule) {
282+
return defaultOpenModule;
283+
}
280284

281285
// third attempt: give up and load the first file in the list
282286
return sandbox.modules[0];

0 commit comments

Comments
 (0)