Firstly, don't get rid of hashes entirely, they're incredibly useful for cache invalidation. I also recommend not starting your own build from scratch unless you know what you're doing; CRA is really good at this stuff, even if it does throw in a bunch of stuff you probably will never use. (Vite templates are also a good solution, see the other answer and especially the comments there).
If you're set on using CRA, first run npm run eject
. This means you'll now be in charge of your own config rather than relying entirely on create-react-app, but you need this to change your Webpack config (or you could use react-app-rewired, customize-cra, or some other similar option).
Change the output to use a shorter contenthash (maybe 4) and change out [name]
for something shorter, like the result of a random character generator that only returns two chars. If you always just produce one bundle, use a static name rather than something dynamic (in brackets). If you don't want chunks, delete the chunk related config.
And if you want the simplest possible solution, still start from create-react-app
and ejecting, but change all of output
to something like this:
const crypto = require('crypto')
const id = crypto.randomBytes(2).toString('hex')
output: {
filename: `x.${id}.js`
}
And definitely gzip the output, with a Make target or shell script or a package.