Skip to content

Commit

Permalink
Lazy load nvexeca
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jan 30, 2022
1 parent 4cdc6e2 commit f0b33ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runners/node/launch/version.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { dirname } from 'path'
import { fileURLToPath } from 'url'

import nvexeca from 'nvexeca'
import { readPackageUp } from 'read-pkg-up'
import semver from 'semver'

Expand Down Expand Up @@ -33,6 +32,9 @@ const normalizeVersion = function (version) {
// This both downloads Node.js binary and normalize its `version`.
// This also retrieves the `command` and `spawnOptions`.
const getFullVersion = async function (version) {
// Lazy loading for performance reasons
const { default: nvexeca } = await import('nvexeca')

try {
return await nvexeca(version, 'node', { progress: true, dry: true })
} catch (error) {
Expand Down

0 comments on commit f0b33ba

Please sign in to comment.