Skip to content

Commit

Permalink
comment: add some context and information about virtual modules ... m…
Browse files Browse the repository at this point in the history
…odule
  • Loading branch information
pieh committed Jun 18, 2020
1 parent d74a2ac commit ca13d28
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/gatsby/src/utils/gatsby-webpack-virtual-modules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import VirtualModulesPlugin from "webpack-virtual-modules"

/*
* This module allows creating virtual (in memory only) modules / files
* that webpack compilation can access without the need to write module
* body to actual filesystem.
*
* It's useful for intermediate artifacts that are not part of final builds,
* but are used in some way to generate final ones (for example `async-requires.js`).
*
* Using virtual modules allow us to avoid unnecessary I/O to write/read those modules,
* but more importantly using virtual modules give us immediate invalidation events
* in webpack watching mode (as opposed to debounced/delayed events when filesystem is used).
* Instant invalidation events make it much easier to work with various state transitions
* in response to external events that are happening while `gatsby develop` is running.
*/

interface IGatsbyWebpackVirtualModulesContext {
writeModule: VirtualModulesPlugin["writeModule"]
}
Expand Down

0 comments on commit ca13d28

Please sign in to comment.