nonzzz / vite-plugin-compression

vite plugin. compress your bundle file.
MIT License
171 stars 10 forks source link

ZSTD? #60

Closed beckend closed 3 months ago

beckend commented 3 months ago

Feature request 🚀

image

Chromium

nonzzz commented 3 months ago

Any others? Aka, Currently plugin support custom algorithm

nonzzz commented 3 months ago

import { compress } from '@mongodb-js/zstd'
import { compression } from 'vite-plugin-compression2'

compression<{ level: number }>({
  algorithm(buf, opt) {
    return compress(buf, opt)
  },
  compressionOptions: {
    level: 9
  }
})
nonzzz commented 3 months ago

Here is a simple usage. Can you have a try?

beckend commented 3 months ago

I get .gz extensions, not sure if that is expected, the files are compressed.

And also type errors.

image

nonzzz commented 3 months ago

Oh, you should set filename option :)

beckend commented 3 months ago

Then it works ok, the types are a bit misleading.

CheesyTech commented 3 months ago

Hi @nonzzz , @beckend . Could you share a complete example of zstd integration for this plugin? It would also be great if someone would immediately give examples of compression integration for this library )

nonzzz commented 3 months ago

@cheeeasy2501 I'll move this issue to discussion