Skip to content

Commit

Permalink
feat: sends config through babel/register
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikrut committed Dec 28, 2020
1 parent efe0b40 commit fec718e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/config/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,29 @@ import path from 'path';
import { Config } from './types';
import findConfig from './find';
import validate from './validate';

const removedExtensions = ['.scss', '.css', '.svg', '.png', '.jpg', '.eot', '.ttf', '.woff', '.woff2'];
import babelConfig from '../babel.config';

const configPath = findConfig();

const removedExtensions = ['.scss', '.css', '.svg', '.png', '.jpg', '.eot', '.ttf', '.woff', '.woff2'];

const loadConfig = (): Config => {
removedExtensions.forEach((ext) => {
require.extensions[ext] = () => null;
});

// eslint-disable-next-line @typescript-eslint/no-var-requires
require('@babel/register')({
...babelConfig,
extensions: ['.ts', '.tsx', '.js', '.jsx'],
env: {
development: {
sourceMaps: 'inline',
retainLines: true,
},
},
});

// eslint-disable-next-line @typescript-eslint/no-var-requires
let config = require(configPath);

Expand Down

0 comments on commit fec718e

Please sign in to comment.