Closed scholtzm closed 7 years ago
I'll just copy this here from https://github.com/electron/asar/issues/55#issuecomment-266725820:
In my case, the dependency calls
.chdir(__dirname)
so I decided to use--unpack-dir
flag to unpack this specific dependency. The result was:
app.asar.unpacked
folder - this folder contains that one dependency I unpackedapp.asar
file - according toasar list
command, this file still contains the dependency as well 🤔When the code is executing,
__dirname
points to folder insideapp.asar
(no idea why, it should beapp.asar.unpacked
❓) and so it fails once again. If I place a breakpoint and modify__dirname
to containapp.asar.unpacked
, it works.
So far I have tried:
unpackDir: '**/steam-resources/**/*'
- unpacks only steam-resources
and everything that's insideunpackDir: 'node_modules/steam/**/*'
- unpacks steam
and everything that is insideunpackDir: 'node_modules/**/*'
- unpacks everything in node_modules
No matter what, the __dirname
here always points to app.asar
. According to asar list
, the folder was also always contained inside app.asar
.
Tested on both Windows and OSX, results are same.
Here's a small repro case I created: https://github.com/scholtzm/electron-asar-dirname-issue
Reported here: https://github.com/electron/electron/issues/8206
Packaging to asar archive right now seems to be causing trouble with node-steam-resources calling chdir.
Perhaps something can be done about this in the future.