Plugin Options" class="reference-link">Plugin Options

    These options then get passed into plugin visitors through the object:

    1. export default function({ types: t }) {
    2. return {
    3. visitor: {
    4. FunctionDeclaration(path, state) {
    5. console.log(state.opts);
    6. }
    7. }
    8. }

    Plugins can have functions that are run before or after plugins. They can be used for setup or cleanup/analysis purposes.

    1. export default function({ types: t }) {
    2. return {
    3. inherits: require("babel-plugin-syntax-jsx")
    4. };

    If you want to throw an error with babel-code-frame and a message:

    1. 7 |
    2. 8 | let tips = [
    3. > 9 | "Click on any AST node with a '+' to expand it",
    4. | ^
    5. 10 |
    6. 11 | "Hovering over a node highlights the \
    7. 12 | corresponding part in the source code",