Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds memory file system support (including tests) Closes #160 #179

Closed
wants to merge 1 commit into from

Conversation

hinell
Copy link

@hinell hinell commented Feb 13, 2019

Rationale

  • There is need to have an ability to use alternative file systems (fs). Like memfs for instance.
  • The wepback is a good example. It can be configured to use its memory-fs module to generate and keep all its assets in memory to gain better performance compared to hdd. By using the compiler.outputFileSystem api as a source we can serve generated files directly from memory.

Changes

  • Options
send(..., ..., { fs: hddFileSystem })

Tests

  • Adds basic tests by reusing old ones (It was ad-hoc solution. Let me know if there is someone who can assist me in writing better tests )
  • Adds command for testing memfs instance (test:m where m stands for in-memory fs)
  • I just added very basic tests which checks out whether fs has some properties necessary to normal functioning. It is obviously only shallow checking and won't save you from having errors arising from using incompatible file systems

Caveats

  • You can't use webpack's memory-fs (the version 0.4.1) currently due to lack of some interfaces but you can use memfs instead. The configuration is tricky though, cause you will have to manually assign a .join() method to the fs instance.

	* Add: new option to specify which file system to use to serve files by default.
	* Add: exported erros for basic file system interface check
	* Add: basic tests via global injection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant