Friday, May 10, 2019

How to transpile a js file from the command line with babel

const f = () => { // < Should be transpiled
    const a = { a:1 };
    const b = { ...a }; // < Should be transpiled

    console.log('f running '+ JSON.stringify(b));


Command Line
npx babel a.js --out-dir ./tmp-fred --ignore spec.js,test.js
The file .babelrc.js should be executed. With Babel v7 it is recommended to use the file babel.config.js, to apply to the transpilation rules to every folder including folder from node_modules, if some libraries need to be transpiled.


1 comment:

  1. Hey Amazing Blog!! Thank You So Much For Sharing!!!Wonderful blog.Its really helpful for me, waiting for a new post. Keep Blogging!
    will help you more:
    Hire some best dancers for your wedding party event or birthday celebration.
    Contact Dynamic Hip-Hop And Western Dance Institute, Indore.