How to use the babel-register function in babel-register

To help you get started, we’ve selected a few babel-register examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github j-s-n / zine / test / setup.js View on Github external
import fs from 'fs';
import path from 'path';
import register from 'babel-register';

const rcPath = path.join(__dirname, '..', '.babelrc');
const source = fs.readFileSync(rcPath).toString();
const config = JSON.parse(source);

config.ignore = (filename) => (/\/node_modules\//).test(filename);

register(config);
github alfg / srv / bin / cmd / transpile.js View on Github external
export default function transpile() {
  const path = require.resolve('babel-runtime/package')
  .replace(/[\\\/]package.json$/, '');

  try {
    register({
      presets: [preset2015],
      plugins: [
        transformRuntime,
        [alias, [
          { src: path, expose: 'babel-runtime' },
        ]],
      ],
    });
    return;
  } catch (e) {
    throw new Error(e);
  }
}

babel-register

babel require hook

MIT
Latest version published 8 years ago

Package Health Score

76 / 100
Full package analysis

Popular babel-register functions

Similar packages