Skip to content

Commit 9d9baa7

Browse files
authored
Resolve plugin ts-node relative to tstl instead of relative to tsconfig.json (#1175)
1 parent 63a683c commit 9d9baa7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/transpilation/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export interface EmitFile extends BaseFile {
3535
export const getConfigDirectory = (options: ts.CompilerOptions) =>
3636
options.configFilePath ? path.dirname(options.configFilePath) : process.cwd();
3737

38+
const getTstlDirectory = () => path.dirname(__dirname);
39+
3840
export function resolvePlugin(
3941
kind: string,
4042
optionName: string,
@@ -59,7 +61,7 @@ export function resolvePlugin(
5961
const hasNoRequireHook = require.extensions[".ts"] === undefined;
6062
if (hasNoRequireHook && (resolved.endsWith(".ts") || resolved.endsWith(".tsx"))) {
6163
try {
62-
const tsNodePath = resolve.sync("ts-node", { basedir });
64+
const tsNodePath = resolve.sync("ts-node", { basedir: getTstlDirectory() });
6365
const tsNode: typeof import("ts-node") = require(tsNodePath);
6466
tsNode.register({ transpileOnly: true });
6567
} catch (err) {

0 commit comments

Comments
 (0)