Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

rootDir option causes an error #40

Closed
Quramy opened this issue Apr 7, 2016 · 2 comments
Closed

rootDir option causes an error #40

Quramy opened this issue Apr 7, 2016 · 2 comments

Comments

@Quramy
Copy link
Contributor

Quramy commented Apr 7, 2016

If my tsconfig.json has rootDir option, TypeScriptSimple causes the following error.

TypeError: Cannot read property 'text' of undefined
    at TypeScriptSimple.toJavaScript (/Users/yosuke/git/typescript-simple/index.js:161:28)
    at TypeScriptSimple.compile (/Users/yosuke/git/typescript-simple/index.js:71:25)
    at Object.<anonymous> (/Users/yosuke/git/typescript-simple/repro.js:3:5)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3

I could reproduce it with the following code.

var TypeScriptSimple = require('./index').TypeScriptSimple;
var tss = new TypeScriptSimple({outDir: 'built/', rootDir: 'src/'}, false);
tss.compile('var x = 123;', 'src/file.ts');

I think it's because that output file name includes the value of rootDir in toJavaScript method.

  • correct output file name(TS Language Service created): built/file.js
  • actual output file name in this method: built/src/file.js
@teppeis
Copy link
Owner

teppeis commented Apr 7, 2016

Fixed in #41 and v5.0.2 has been released.
Thanks! 👍

@teppeis teppeis closed this as completed Apr 7, 2016
@Quramy
Copy link
Contributor Author

Quramy commented Apr 7, 2016

Thanks for your quick review and release :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants