logoalt Hacker News

efortis • today at 7:14 AM • 3 replies • view on HN

There's room for improvement still. Currently, the production build is using long-dev class names. e.g. `DirectoryContent-module__Box_3__gl6dE` could be compiled to a shorter hash like `gl6DE3a2`.

If you use Vite:

  css: {
    modules: {
      generateScopedName: mode === 'production'
        ? '[hash:base64:8]'
        : '[name]__[local]___[hash:base64:5]',
      }
    }

Replies

eviks • today at 7:31 AM

The improvement would be shipping human-readable structure to allow easier user overrides, not that hash abomination

robin_reala • today at 7:50 AM

Those class names surely gzip better than hashes over the wire?

➕ show 2 replies
Onavo • today at 7:22 AM

Would you need a source map then for prod debugging?