Skip to content

Commit 910f3b3

Browse files
committed
Remove useless intermediary variable
1 parent 6162d29 commit 910f3b3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

source/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,17 @@ async function nodeExternals(options: ExternalsOptions = {}): Promise<Plugin> {
179179
for (let current = process.cwd(), previous: string | undefined = undefined; previous !== current; previous = current, current = path.dirname(current)) {
180180

181181
// Gather package.json files.
182-
const name = path.join(current, 'package.json')
183-
const stat = await fs.stat(name).catch(() => null)
184-
if (stat?.isFile())
182+
let name = path.join(current, 'package.json')
183+
if (await fs.stat(name).then(stat => stat.isFile()).catch(() => false))
185184
packagePaths.push(name)
186185

187186
// Break early if we are at the root of a git repo.
188187
if (current === gitRepository)
189188
break
190189

191190
// Break early is there is a known workspace root file.
192-
for (const file of workspaceRootFiles) {
193-
if (await fs.stat(path.join(current, file)).then(stat => stat.isFile()).catch(() => false))
191+
for (name of workspaceRootFiles) {
192+
if (await fs.stat(path.join(current, name)).then(stat => stat.isFile()).catch(() => false))
194193
break search
195194
}
196195
}

0 commit comments

Comments
 (0)