epsitec-sa / hazardous

Overload Electron path module for asar.unpacked support
68 stars 6 forks source link

Removed unnecessary dependency for original-fs package #4

Closed kiddailey closed 6 years ago

kiddailey commented 6 years ago

When including this package in my Electron project, I get an error trying to resolve "original-fs" on line 44:

const fs = process.versions.electron
     ? require ('original-fs')
     : require ('fs');

Looking at the package.json, I see that original-fs is not included as a dependency. All this package does is wrap a require("fs") in a module.exports, which seems unnecessary. I confirmed by modifying these lines to the following and it worked as expected.

const fs = require ('fs');
Skywalker13 commented 6 years ago

original-fs should be provided by electron in order to read an asar file like a file and not its content (it's builtin).

https://electronjs.org/docs/tutorial/application-packaging#treating-an-asar-archive-as-a-normal-file

What version of electron do you use and provide the link/info where original-fs was removed please.

Skywalker13 commented 6 years ago

I can replace original-fs by

image

But IMHO something is wrong with your electron version.

kiddailey commented 6 years ago

Thanks for the clarification.

It appears that webpack may actually be the issue. There was a bug relating to original-fs that was fixed with webpack 4.0.0 back in February. I haven't yet upgraded to the 4.x series for this particular project because of some other dependencies.

Your example seems to say that I could change Hazardous to set process.noAsar based on the presence of process.versions.electron instead of requiring original-fs. Am I understanding correctly?

Skywalker13 commented 6 years ago

Your example seems to say that I could change Hazardous to set process.noAsar based on the presence of process.versions.electron instead of requiring original-fs. Am I understanding correctly?

Correct