Skip to content

tsconfig.json typeRoots path ignores --source-dir #2550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mh-dev opened this issue Oct 6, 2016 · 5 comments
Closed

tsconfig.json typeRoots path ignores --source-dir #2550

mh-dev opened this issue Oct 6, 2016 · 5 comments

Comments

@mh-dev
Copy link

mh-dev commented Oct 6, 2016

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 10

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.16
node: 6.6.0
os: win32 x64
global install via
git clone https://github.com/angular/angular-cli.git
cd angular-cli
npm link

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
mkdir
ng init --source-dir src/main/web

The log given by the failure.

Normally this include a stack trace and some more information.
ERROR in [default] {path}\src\main\web\app\app.component.ts:5:12
Cannot find name 'require'.
ERROR in [default] {path}\src\main\web\app\app.component.ts:6:11
Cannot find name 'require'.

Mention any other details that might be useful.

The generated typeRoots is '../node_modules/@types' but it should be '../../../node_modules/@types'


Thanks! We'll be in touch soon.

@bthharper
Copy link

bthharper commented Oct 8, 2016

If you've added a types element into tsconfig.json, then all the types are not included automatically by tsc only those specified, so you can either:

a) explicitly add "node"
b) or just add: declare var require: any; to typings.d.ts.

@mh-dev
Copy link
Author

mh-dev commented Oct 8, 2016

Its not that I don't know a way to resolve this problem. But the generated project is just incorrect and this should be fixed in some way. I personally will take look into the cli in a few weeks again. Right now I am running into to much problems.

@bthharper
Copy link

Sorry, I see your issue now. Good luck with submitting a PR - sounds like a good fix to make.

@filipesilva
Copy link
Contributor

Dupe of #2206

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
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

3 participants