Skip to content

Instantly share code, notes, and snippets.

@stephencookdev
Last active April 24, 2020 14:46
Show Gist options
  • Save stephencookdev/e4b464fa73257fe463c010a1855693b4 to your computer and use it in GitHub Desktop.
Save stephencookdev/e4b464fa73257fe463c010a1855693b4 to your computer and use it in GitHub Desktop.
Example of a simple Babel plugin
module.exports = function () {
const SimpleVisitor = {
StringLiteral(path, state) {
if (path.node.value === "We'll never survive!") {
path.node.value = "Nonsense. You're only saying that because no one ever has.";
}
},
};
return { visitor: SimpleVisitor };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment