Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);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);
}
}