Skip to content

Make TypeScript basePath configurable, fixes #619#621

Merged
johnnyreilly merged 2 commits intoTypeStrong:masterfrom
loilo:make-root-configurable
Sep 6, 2017
Merged

Make TypeScript basePath configurable, fixes #619#621
johnnyreilly merged 2 commits intoTypeStrong:masterfrom
loilo:make-root-configurable

Conversation

@loilo
Copy link
Copy Markdown
Contributor

@loilo loilo commented Sep 5, 2017

Enables the behaviour suggested in #619 to modify the basePath provided to the TS compiler.

Added:

  • Implementation
  • Comparison test
  • Hint in README

@johnnyreilly
Copy link
Copy Markdown
Member

Great! I'll look to include this in the next release. Thanks!

@johnnyreilly johnnyreilly merged commit 3296ef7 into TypeStrong:master Sep 6, 2017
@johnnyreilly
Copy link
Copy Markdown
Member

@pettyalex
Copy link
Copy Markdown

This seems to break the default tsconfig.json as distributed with create-react-app-typescript.

I'm seeing failures with

TS6059: File '/app/src/App.test.tsx' is not under 'rootDir' '/app/src/src'. 'rootDir' is expected to contain all source files.�

@pettyalex
Copy link
Copy Markdown

pettyalex commented Sep 6, 2017

The quick and dirty workaround is to change rootDir to '.' rather than 'src', but I'm not sure whether create react app's tsconfig is wrong, or some other part of the build pipeline is causing the issue.

I should really give more info, the default project structure with create-react-app-typescript has tsconfig in the project base path, and src contains all source files, but with this latest change the typescript compiler is looking in src/src for some reason.

@loilo
Copy link
Copy Markdown
Contributor Author

loilo commented Sep 7, 2017

That's weird. As far as I can tell, the provided basePath should be correct (it does not contain src/src, just a single src).

I'm probably going to have to look into how exactly TypeScript handles the basePath, this smells like some errornous assumptions from my side.

@johnnyreilly
Copy link
Copy Markdown
Member

If you could look into this I'd appreciate that @loilo. @pettyalex let's see what @loilo comes up with. If all else fails we can revert this change and push out a new version. For now I would pin your version to 2.3.4 though.

@loilo
Copy link
Copy Markdown
Contributor Author

loilo commented Sep 7, 2017

I think that's currently the best solution. I created a quick repro repo where I couldn't nail it down yet, gonna get to work now but going to look at the problem from there. I suggest to move every further communication over to wmonk/create-react-app-typescript#156.

johnnyreilly pushed a commit that referenced this pull request Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants