chr314 / babel-plugin-wrap-profiler

Babel Plugin that wraps profiler to each component in your code base

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

babel-plugin-wrap-profiler

A Babel plugin that wraps components with Profiler.

Usage

Install

For Yarn

yarn add -D babel-plugin-wrap-profiler

For npm

npm install --save-dev babel-plugin-wrap-profiler

Configure Babel

// In your .babelrc
{
    "plugins": [
        "babel-plugin-wrap-profiler"
    ]
}

Log Profiler Results

// In your code
import React from 'react';
import { logComponents } from "babel-plugin-wrap-profiler/lib/profiler-utils";


const Component = () => {
    return (
        <button onClick={logComponents}>
            Log Components
        </button>
    );
};

Credits

About

Babel Plugin that wraps profiler to each component in your code base


Languages

Language:JavaScript 100.0%