README
Babel timing
Measure Babel compilation time file by file, plugin by plugin.
Profile Babel when your application or your tests take ages to build.
Note: this tool is in version 0, any minor release might introduce breaking changes.
Installation
npm i babel-timing -D
yarn add babel-timing -D
Usage
As standalone library via CLI
babel-timing path/to/file-1.js path/to/file-2.js
babel-timing path/to/file-*.js
babel-timing path/to/entrypoint.js --follow-imports
As standalone library via Node
const { babelTiming } = require('babel-timing');
const results = await babelTiming(['path/to/file.js'], options);
As Webpack integration
Profile Babel during the actual Webpack bundling process.
- Import
babel-timing/webpack/plugin
to Webpack configuration:
const BabelTimingPlugin = require('babel-timing/webpack/plugin');
- Add
customize
option to the existingbabel-loader
configuration:
module: {
rules: [
{
test: /\.m?js$/,
use: {
loader: 'babel-loader',
options: {
customize: require.resolve(
'babel-timing/webpack/babel-loader-customize'
),
},
},
},
];
}
- Add
babel-timing/webpack/plugin
plugin (accepts the render options):
plugins: [new BabelTimingPlugin()];
...with options (accepts output
and outputPath
options):
plugins: [
new BabelTimingPlugin({ output: 'json', outputPath: './results.json' }),
];
Delete
babel-loader
cache at./node_modules/.cache/babel-loader/
Start Webpack bundling process and wait for results
As Jest integration
Profile Babel while running your actual Jest tests.
- Add the following
transform
andreporters
entries to the existing Jest configuration:
{
transform: {
'^.+\\.jsx?