babel-codemod-example

An example of how to use babel as a codemod

Stars
26

babel-codemod-example

When ES modules land in Node, it will be impossible to do this:

import {thing} from './common-js-module'

Because CommonJS is not statically analyzable. However many people (myself included) have been doing this for a long time:

import {readFile} from 'fs'

In this quick video, I show you a quick babel plugin I wrote to do a codemod on my code to fix this automatically.