For create a production version for all assets files, run this command in the terminal :
npm run build
Don't forget to change in the file
wp-config.php, this declarations :
// for productiondefine('WP_ENV', 'production');
The files are automatically injected into website. The files are a hash versions in name to avoid cache problem.