DEV Community

Lukas Gaucas
Lukas Gaucas

Posted on

Webpack devServer : writeToDisk

As per default , webpack devServer will serve bundle in-memory (session) without writing to disk i.e.:

TIP : the following writeToDisk: false is suitable for development mode specifically !

    ...,
    devMiddleware: {
      ...,
      writeToDisk: false, /* default : serve in-memory only */
      ...,
    },
    ...,
Enter fullscreen mode Exit fullscreen mode

Served in-memory & written in-disk (persistency) with respect to any changes within your code base made whilst developing :

    ...,
    devMiddleware: {
      ...,
      writeToDisk: true, /*serve in-memory as you did before but save to disk as well (changes to file[s] respected) */
      ...,
    },
    ...,
Enter fullscreen mode Exit fullscreen mode

NOTE : writeToDisk:<value=false|true> becomes quite useless if explicitly bundled with (npx) webpack bundle prior to any serving done !


Refs

devServer.writeToDisk

Top comments (0)