robcresswell / nuxt-compress

A simple static asset compression module for Nuxt that runs Gzip and Brotli compression during the build process
https://www.npmjs.com/package/nuxt-compress
MIT License
102 stars 9 forks source link

Nuxt still serving gzip version #20

Closed nachijr4 closed 3 years ago

nachijr4 commented 4 years ago

I have installed the package and configured the config file. When I ran npm run build command I can see Brotli compressed files getting generated, but while serving it only sends out gzip files. I'm using Nginx as a reverse proxy. I have enabled Brotli compression on Nginx also. Is there any configuration that I am missing here?

robcresswell commented 4 years ago

Nothing that relates to this plugin; the plugin deals only with generating the assets.

Keep in mind Brotli is only supported over HTTPS, so that might be why you're not seeing the assets being served. Otherwise its likely an Nginx misconfiguration.

alishahlakhani commented 4 years ago

+1 having same issue. Even on local I'm unable to serve br code

buildModules: [
    [
      "nuxt-compress",
      {
        brotli: {
          asset: '[path].br[query]',
          test: /\.(js|css|html|svg|woff|woff2)$/,
          threshold: 0,
          minRatio: 0.8,
          deleteOriginalAssets: true
        }
      }
    ]
  ],
robcresswell commented 4 years ago

@alishahlakhani Did you read my comment? This plugin doesn't serve them for you, just creates them. I'm not here to debug your nginx / browser setups :smile: