Create-react-app: Make compression in webpack-dev-server configurable

Created on 24 Feb 2017  路  5Comments  路  Source: facebook/create-react-app

I'm running into the same issue as https://github.com/facebookincubator/create-react-app/issues/966#issuecomment-271311044 when using SSE via a proxy.

Would it be possible to make the compression configurable via env?

proposal

Most helpful comment

Until a solution arrives (like proposed by @gaearon), some may find it useful to work around the issue by adding a Cache-Control: no-transform HTTP header to the SSE server. This prevents the compression module from buffering and compressing the stream.

All 5 comments

Not strictly opposed to this, but can we somehow only restrict compression to the assets WDS serves, and not to anything proxied?

Until a solution arrives (like proposed by @gaearon), some may find it useful to work around the issue by adding a Cache-Control: no-transform HTTP header to the SSE server. This prevents the compression module from buffering and compressing the stream.

Closing as stale. If somebody wants to fix this please send a PR.

This has most certainly caused problems with Server-Sent-Events. I'm using this in my project, and have determined that the gzip compression is causing the event connection to close. I'm struggling to find a way to unset this - however, it's not clear to me why this change was made to default with compression enabled, since in a development environment it's a low-impact issue to have non-compressed files served. The trade-off of making SSE unusable doesn't seem to have been a good call.

Thanks.

@don-p as a quick workaround, setting Cache-Control: no-transform on the SSE call will force Webpack Dev Server not to compress/buffer up the content.

But I agree, enabling compression on Webpack Dev Server is low-impact.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ap13p picture ap13p  路  3Comments

wereHamster picture wereHamster  路  3Comments

fson picture fson  路  3Comments

Aranir picture Aranir  路  3Comments

barcher picture barcher  路  3Comments