It's easy! There are only 2 steps:
-
Install required packages with NPM:
npm install browserify babelify
-
Create package.json with the following content (here main.js file is source file and bundle.js is output file. Also note we are applying transformer to browserify command):
{ "scripts": { "build-js": "browserify -t babelify main.js > bundle.js"
}