I am trying to deal with the browser and ES6 at the same time. I have the following main Node files:
main.js
var foo = require('./foo.js'); var x = foo.math(200); console.log(x);
foo.js
exports.math = (n)=>{ return n * 111; };
Now I want to do the following:
- Label this in the
bundle.js file bundle.js that I can include it as a script on my website. - Compile JS with babel to make ES6 readable by all browsers.
- Minify
bundle.js to improve browser loading time.
I have a browser installed globally and I launch it with this command: browserify main.js > bundle.js
It works great. But should I run babel first? How can I complete my 3-step process and in what order (of course, mining should happen last)? Should I do all this with grunts?
Coop
source share