Here is an example I wrote (fully custom script) that handles 3 types of code:
Web Components (Modern JS) - Using Terser, minification only
React Components
Terser to minimize build targetting modern browsers
Babel Standalone (smaller version of babel intended for Brwoser) to target older browers
uglify-js to minify ES5 code in the project
With the custom script I simply run npm run build and it created *.min.js of each file and handles the React Components. This is a large project though so I think this would be overkill for the vast majority of projects, but individual parts of it can apply to many projects.
For Vanilla JavaScript I just minimize if no build is required and I use Terser for Modern Code and `uglify-js' for ES5 code.
Here is an example I wrote (fully custom script) that handles 3 types of code:
With the custom script I simply run
npm run build
and it created*.min.js
of each file and handles the React Components. This is a large project though so I think this would be overkill for the vast majority of projects, but individual parts of it can apply to many projects.github.com/dataformsjs/dataformsjs...