Skip to content

Commit bef7b95

Browse files
committed
Move var initialization into tighter scope
1 parent 0bc1194 commit bef7b95

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/gatsby/src/utils/api-runner-node.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,20 @@ module.exports = async (api, args = {}, pluginSource) =>
144144

145145
apisRunning.push(apiRunInstance)
146146

147-
let currentPluginName = null
148-
149147
mapSeries(
150148
noSourcePluginPlugins,
151149
(plugin, callback) => {
152-
let currentPluginName
150+
let pluginName = null
153151
if (plugin.name === `default-site-plugin`) {
154-
currentPluginName = `gatsby-node.js`
152+
pluginName = `gatsby-node.js`
155153
} else {
156-
currentPluginName = `Plugin ${plugin.name}`
154+
pluginName = `Plugin ${plugin.name}`
157155
}
158156
Promise.resolve(runAPI(plugin, api, args)).asCallback(callback)
159157
},
160158
(err, results) => {
161159
if (err) {
162-
reporter.error(`${currentPluginName} returned an error`, err)
160+
reporter.error(`${pluginName} returned an error`, err)
163161
}
164162
// Remove runner instance
165163
apisRunning = apisRunning.filter(runner => runner !== apiRunInstance)

0 commit comments

Comments
 (0)