Skip to content

Commit

Permalink
fix: ts-node loading (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 3, 2023
1 parent 76c75a8 commit 38b1992
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/utils.js
Expand Up @@ -4,7 +4,6 @@ import Module from "module";

import { klona } from "klona/full";
import { cosmiconfig, defaultLoaders } from "cosmiconfig";
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";

import SyntaxError from "./Error";

Expand Down Expand Up @@ -167,9 +166,13 @@ async function loadConfig(loaderContext, config, postcssOptions) {
};

if (isTsNodeInstalled) {
loaders[".cts"] = TypeScriptLoader();
loaders[".mts"] = TypeScriptLoader();
loaders[".ts"] = TypeScriptLoader();
// eslint-disable-next-line global-require
const { TypeScriptLoader } = require("cosmiconfig-typescript-loader");
const loader = TypeScriptLoader();

loaders[".cts"] = loader;
loaders[".mts"] = loader;
loaders[".ts"] = loader;
}

const explorer = cosmiconfig(moduleName, {
Expand Down

0 comments on commit 38b1992

Please sign in to comment.