I use webpack-compression-plugin ta compress all my static files and hml files beforehand to gzip and brotli format. If browser supports it I use brotli, if not gzip and last option is original file. So I would have something like this for example after bundling.
bundle.js bundle.js.gz bundle.js.br On server I use express-static-gzip to serve static files and everything is working fine. All my client static assets are compressd and served like that.
import expressStaticGzip from 'express-static-gzip' const app: Express = new Express() process.env.PWD = process.cwd() app.set('view engine', 'ejs') app.set('views', path.join(process.env.PWD + '/src/server/views')) app.use(expressStaticGzip(path.join(process.env.PWD + '/src/dist'), {indexFromEmptyFile: false, enableBrotli: true, maxAge: '1y'})) app.use((req, res, next) => { res.set('Cache-Control', 'no-cache') return next() }) /* Use server side rendering for first load */ app.use(appRenderer) // Routes app.get('*', (req, res) => { res.render('index') }) app.listen(PORT, () => { console.log(` Express server is up on port ${PORT} Production environment `) }) The problem I have is with my html file, root. Although I also have gzip and br version of it, it is not served like that. I make it by bundling server side code. Express compression module doesn't work and I also want static compression. I am not using nginx. 
.jsand.cssbcoz I don't want server to compressjsandcssfor SSR on each requestcontent-typein request header, which accepts gzip format.. May be I need to read more on this :) Also check answer below in 2 min... I got something working..