Last active
April 24, 2020 14:46
-
-
Save stephencookdev/e4b464fa73257fe463c010a1855693b4 to your computer and use it in GitHub Desktop.
Example of a simple Babel plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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