Closed kkqy closed 3 years ago
Have you tried setting an external VBS location in the package? Refer to #60 for more information (It's for ASAR but it may work for your app as well, take a look and see if it works). The readme also has information on how to use that.
I've done this way and i just need to have my package and vbs at the same level. Obviously you can decide to change level.
let regedit = require('regedit')
const pathNode = require('path');
const appDir = pathNode.resolve()
await regedit.setExternalVBSLocation(appDir + '/vbs');
regedit = require('regedit').promisified
if you are using electron-forge you should set your config like this
const config: ForgeConfig = {
packagerConfig: {
extraResource: ["node_modules/regedit/vbs"],
},
};
then the scripts will go to (on Windows)
C:\Users\$USER\AppData\Local\electron-app\app-1.0.0\resources\vbs
so you can just
const vbsDir = path.join(process.resourcesPath, "vbs");
setExternalVBSLocation(vbsDir);
If I use pkg(https://github.com/zeit/pkg) to pack my project, this module can't work,and it shows:
Is there any way to fix it?