webpack / enhanced-resolve

Offers an async require.resolve function. It's highly configurable.
MIT License
932 stars 188 forks source link

[Question] - custom fs implementation #172

Closed dazinator closed 5 years ago

dazinator commented 5 years ago

Hello,

I would like to use an alternative underlying fs implementation, such as memfs or unionfs I am not sure If I can do this, as NodeJsInputFileSystem seems to be harcoded to use a particular underlying fs implementation. What would be the best way to go about this? Thanks

alexander-akait commented 5 years ago

Send a PR to allow setup own fs

dazinator commented 5 years ago

Currently, the methods that access fs are defined at the prototype level:

https://github.com/webpack/enhanced-resolve/blob/95e27d33d052fe955d297c6165111cfd0cc03240/lib/NodeJsInputFileSystem.js#L42

I think I'd need to remove that and have them declared at the class instance level, so that if a custom fs is passed in the constructor then that can be used, otherwise fall back to default fs implementation based on the graceful-fs. Does this sound ok with you?

alexander-akait commented 5 years ago

Yes

dazinator commented 5 years ago

Great. PR #173 Submitted!

sokra commented 5 years ago

fixed, you can pass a fileSystem i. e. fs or memfs