Create option to disable webpack-dev-server and compile webpack to file system
Currently we utilize webpack-dev-server
in the GDK which compiles our frontend assets and retains them in memory so that when developers make changes to our frontend code, it can be quickly re-compiled and served.
However, webpack-dev-server
takes up a LOT of memory, and there are many legitimate cases where one may prefer to only compile assets on-demand without retaining them in memory.
Deliverable description
- Create an option, controlled by an environment variable (e.g.
DEV_SERVER_STATIC=true
), which will disablewebpack-dev-server
and instead runwebpack
to compile assets to disk, then watch for changes in the filesystem, and runwebpack
again on-demand to re-compile as necessary. - Ensure these assets are compiled into a transient directory, and ignored by source control
- Ensure that these assets are cleaned up properly when the process is terminated, and that switching back to
webpack-dev-server
does not cause any problems with cached assets - Document the trade-offs of using this option versus
webpack-dev-server
and cite examples of when one may want to use this (e.g. the GEO team which requires multiple copies of the GDK to run at once).