shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.4k stars 123 forks source link

fix: only have the stream close after writing Webpack filesystem caches #244

Open pxpeterxu opened 3 years ago

pxpeterxu commented 3 years ago

Motivation

I wanted to use webpack-stream with Webpack 5's filesystem caches so that we can improve incremental build performance when starting Webpack again. I used a Webpack configuration similar to:

const stream = webpack({
  config: {
    mode: 'development',
    output: {filename: 'bundle.js'},
    cache: {
      type: 'filesystem',
      idleTimeoutForInitialStore: 0,
    },
  }
});

I noticed that:

After digging into error messages a bit, I realized that:

Changes

Testing

Added an automated test. Also, ran this with my (much larger) project and verified that this worked as expected