There was previously a documentation to build a minimized.js embedding the necessary modules for a particular project with a configuration file. The french version can still be found, although outdated at : https://openlayers.org/workshop/fr/custom-builds/create.html
For those like me preferring to avoid developing within node, that was handy!
What would be the way to do so with Openlayers 6?
____ EDIT _____ I tried to be nore specific in the new version of this question at: Minified OpenLayers in CommonJs