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

in-memory filesystem for webpack assets #83

Merged
merged 11 commits into from
Dec 28, 2016
Merged

in-memory filesystem for webpack assets #83

merged 11 commits into from
Dec 28, 2016

Conversation

zinserjan
Copy link
Owner

@zinserjan zinserjan commented Dec 10, 2016

All webpack assets are now handled by an in memory filesystem as suggested in #25. No files are written to disk.

How does it work?

  • all compiled files by webpack are stored in memory-fs
  • we hook into the path resolution algorithm of all require calls to look also for file existence in the memory-fs
  • we hook into the compile algorithm of all require calls to read the bundle from memory

At the moment this works only for .js files, cause we need to register each file extension manually. But this should be fine as nodejs only understands .js, .json and .node files and as far as I know webpack emits only .js files.

Tasks:

  • write bundle to memory
  • read bundle to memory
  • compatibility with sourcemaps
  • integration tests for code splitting
  • debug support for IDE's (works fine with Webstorm, VS Code works only with debugger statements)
  • clean up all hooks when ready

@codecov-io
Copy link

codecov-io commented Dec 10, 2016

Current coverage is 85.44% (diff: 96.70%)

Merging #83 into master will increase coverage by 3.28%

@@             master        #83   diff @@
==========================================
  Files            16         18     +2   
  Lines           398        474    +76   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            327        405    +78   
+ Misses           71         69     -2   
  Partials          0          0          

Powered by Codecov. Last update e26313c...27e4f72

@zinserjan
Copy link
Owner Author

@serut
I modified the path resolution to fix the code splitting stuff. Can you please test it again against my latest changes?

@serut
Copy link

serut commented Dec 14, 2016

Amazing work @zinserjan, it fully works on my project ! I read tests that you wrote and they are very good !

git checkout in-memory
git pull
npm install
npm run build
npm run test:mocha
  159 passing (373ms)
  4 pending

Well done.

@zinserjan
Copy link
Owner Author

Nice!

But I think that changing files which are required inside require.ensure will not be reloaded or simply said: watch mode does not work with code splitting at the moment...

@zinserjan zinserjan merged commit 677d656 into master Dec 28, 2016
@zinserjan zinserjan deleted the in-memory branch December 28, 2016 16:10
This was referenced Dec 28, 2016
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.

3 participants