Skip to content

Commit

Permalink
Add TypeScript to file filter
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tran committed Nov 9, 2017
1 parent a12b931 commit 69c68d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/relay-compiler/core/RelayJSModuleParser.js
Expand Up @@ -94,6 +94,11 @@ function getParser(baseDir: string): ASTCache {
function getFileFilter(baseDir: string): FileFilter {
return (file: File) => {
const text = fs.readFileSync(path.join(baseDir, file.relPath), 'utf8');
if (/^\.tsx?$/.test(path.extname(file.relPath))) {
const tsconfig = __non_webpack_require__(path.resolve('tsconfig.json'));
const ts = require('typescript');
text = ts.transpileModule(text, tsconfig).outputText;
}
return text.indexOf('graphql') >= 0;
};
}
Expand Down

0 comments on commit 69c68d5

Please sign in to comment.