diff --git a/example.ts b/example.ts index a201bd7..1274c61 100644 --- a/example.ts +++ b/example.ts @@ -1 +1,12 @@ + console.log('Some .ts code reproducing a bug'); +declare const require: any; + +// When this file is added to `getScriptFileNames`, `getProjectVersion` is not +// incremented. +// Therefore, when ts-node tries to get the transpiled output of this file, +// TypeScript erroneously uses the old `Program` instance where this file is considered +// "external" and therefore is not emitted. +import './src/node_modules/causes-problem'; + +require('./src/no-problem'); diff --git a/src/no-problem.ts b/src/no-problem.ts new file mode 100644 index 0000000..456af40 --- /dev/null +++ b/src/no-problem.ts @@ -0,0 +1,2 @@ +console.log('this file will be transpiled no problem'); +export const foo = 123; \ No newline at end of file diff --git a/src/node_modules/causes-problem.ts b/src/node_modules/causes-problem.ts new file mode 100644 index 0000000..355e2c7 --- /dev/null +++ b/src/node_modules/causes-problem.ts @@ -0,0 +1,2 @@ +console.log('this file will not be transpiled, causing a syntax error.'); +export const foo = 123; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a1fe798 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,5 @@ +{ + "ts-node": { + "skipIgnore": true + } +} \ No newline at end of file