See Static content signing in the developer documentation.
The Static File Settings configuration is available only when working in developer mode.
Enable signed static files
On the Admin sidebar, go to Stores > Settings > Configuration.
In the left panel, expand Advanced and choose Developer.
Expand the Static Files Settings section.
Set Sign Static Files to
When complete, click Save Config.