Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use fileTypes from interpret #1690

Merged
merged 2 commits into from
Jul 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions packages/webpack-cli/lib/groups/ConfigGroup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { existsSync } = require('fs');
const { resolve, sep, dirname, parse } = require('path');
const { extensions } = require('interpret');
const { extensions, jsVariants } = require('interpret');
const GroupHelper = require('../utils/GroupHelper');
const rechoir = require('rechoir');

Expand All @@ -26,12 +26,6 @@ const modeAlias = {
development: 'dev',
};

const fileTypes = {
'.babel.js': ['@babel/register', 'babel-register', 'babel-core/register', 'babel/register'],
'.babel.ts': ['@babel/register'],
'.ts': ['ts-node/register', 'tsconfig-paths/register'],
};

const getDefaultConfigFiles = () => {
return DEFAULT_CONFIG_LOC.map((filename) => {
return Object.keys(extensions).map((ext) => {
Expand Down Expand Up @@ -69,7 +63,7 @@ class ConfigGroup extends GroupHelper {
}

requireConfig(configModule) {
const extension = Object.keys(fileTypes).find((t) => configModule.ext.endsWith(t));
const extension = Object.keys(jsVariants).find((t) => configModule.ext.endsWith(t));

if (extension) {
this.requireLoader(extension, configModule.path);
Expand Down