How to use babel-register - 3 common examples

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 babel / babel / scripts / babel-register.js View on Github external
"use strict";

const register = require("babel-register").default;
const config = require("../.babelrc");

register(Object.assign({}, config, {
  extensions: [".js"],
  // Only js files in the test folder but not in the subfolder fixtures.
  only: [/packages\/.+\/test\/(?!fixtures\/).+\.js$/],
  compact: true,
}));
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 7 years ago

Package Health Score

82 / 100
Full package analysis

Popular babel-register functions