Bug inside “regedit” npm package?

This is not the usual stupid .wsf files missing in production build question.
I am using regedit 5.1.3 with an electron-forge application together with webpack and react (no typescript). I get the error

Input Error: Can not find script file "C:UsersalexDesktopprojectdirundefinedvbsregList.wsf"

I have set the custom vbs location like this:

regedit.setExternalVBSLocation(path.join(process.cwd(), "/resources/vbs/"))

I checked 100 times for the path and they are all ok.
Lets take a look at the definitioin of setExternalVBSLocation inside the regedit library

module.exports.setExternalVBSLocation = function(newLocation) {
    if (fs.existsSync(newLocation)) {
        externalVBSFolderLocation = newLocation
        return 'Folder found and set'
    }

    return 'Folder not found'
}

The function should return 'Folder found and set' if the setting went succesfully and 'Folder not found' if it didn’t.
I console logged the calling of the function like so:

console.log(regedit.setExternalVBSLocation(path.join(process.cwd(), "/resources/vbs/")))

An indeed i get Folder found and set!
Now lets take a look at the definition of baseCommand where the actual sauce is happening. This function is called everytime a modification has to be performed to the registry:

function baseCommand(cmd, arch) {
    let scriptPath

    // test undefined, null and empty string
    if (externalVBSFolderLocation && typeof(externalVBSFolderLocation) === 'string') {
        scriptPath = externalVBSFolderLocation
    } else {
        scriptPath = path.join(__dirname, 'vbs')
    }

    return ['//Nologo', path.join(scriptPath, cmd), arch]
}

Focus on the first if condition. According to my situation the condition should be true and it is because i can log to the console before the attribution to scriptPath:

...  
if (externalVBSFolderLocation && typeof(externalVBSFolderLocation) === 'string') {
    console.log(externalVBSFolderLocation) // <-- logging works
    scriptPath = externalVBSFolderLocation
    console.log(scriptPath) // Logs: "C:UsersalexDesktopprojectdirresourcesvbs"
}
...

As you can see everything is normal until i console.log(scriptPath) before the return of baseCommand function:

    ...
    console.log(scriptPath) // Logs some total BULL$HIT: "undefinedvbs"
    return ['//Nologo', path.join(scriptPath, cmd), arch]
}

What in the WORLD is happening. Why the value of scriptPath is different right after it has been attributed?
If I modify the baseCommand function to:

function baseCommand(cmd, arch) {
    return ['//Nologo', path.join(externalVBSFolderLocation, cmd), arch]
}

Everything works like a charm without all those conditions. The problem is that i have to modify the internal code of the package to get it to work…
I want to understand better what is going on with the scriptPath variable. This is a very strange behaviour that I have never seen in programming!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật