From fec718e9e523b1e92ca2dc216d99eef2dcbed83a Mon Sep 17 00:00:00 2001 From: James Date: Sun, 27 Dec 2020 21:23:41 -0500 Subject: [PATCH] feat: sends config through babel/register --- src/config/load.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/config/load.ts b/src/config/load.ts index 83cd8aadb4..79f9a77608 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -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);