Two Quick Ways To Reduce React App’s Size In Production
rajaraodv
1.3K29

When using express middleware with css it didn’t work because of the content type was incorrect it has to be this way

app.get(‘*.js’, function(req, res, next) {
req.url = req.url + ‘.gz’;
res.set(‘Content-Encoding’, ‘gzip’);
res.set(‘Content-Type’, ‘text/javascript’);
next();
});
app.get(‘*.css’, function(req, res, next) {
req.url = req.url + ‘.gz’;
res.set(‘Content-Encoding’, ‘gzip’);
res.set(‘Content-Type’, ‘text/css’);
next();
});
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.