Skip to content

Commit 38b1992

Browse files
fix: ts-node loading (#640)
1 parent 76c75a8 commit 38b1992

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/utils.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Module from "module";
44

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

98
import SyntaxError from "./Error";
109

@@ -167,9 +166,13 @@ async function loadConfig(loaderContext, config, postcssOptions) {
167166
};
168167

169168
if (isTsNodeInstalled) {
170-
loaders[".cts"] = TypeScriptLoader();
171-
loaders[".mts"] = TypeScriptLoader();
172-
loaders[".ts"] = TypeScriptLoader();
169+
// eslint-disable-next-line global-require
170+
const { TypeScriptLoader } = require("cosmiconfig-typescript-loader");
171+
const loader = TypeScriptLoader();
172+
173+
loaders[".cts"] = loader;
174+
loaders[".mts"] = loader;
175+
loaders[".ts"] = loader;
173176
}
174177

175178
const explorer = cosmiconfig(moduleName, {

0 commit comments

Comments
 (0)