Skip to content
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

Add baseUrl documentation #6847

Merged
merged 4 commits into from
Apr 19, 2019
Merged

Conversation

ianschmitz
Copy link
Contributor

Closes #6765.

/cc @rovansteen, @iansu, @mrmckeb

docusaurus/docs/importing-a-component.md Outdated Show resolved Hide resolved
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src/**/*"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed. I could definitely be wrong about that though. When I was testing this I wasn't using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You definitely don't need it, you're right. It's recommended by VS Code team to avoid performance issues when you add this file. This link explains it well: https://code.visualstudio.com/docs/languages/jsconfig. The key thing to note:

If you do not have a jsconfig.json in your workspace, VS Code will by default exclude the node_modules folder.

When your JavaScript project is growing too large and performance slows, it is often because of library folders like node_modules. If VS Code detects that your project is growing too large, it will prompt you to edit the exclude list.

So once we add this file, it by default will include everything in the directory of jsconfig.json and all subdirectories, including node_modules. By using include it explicitly says "only check these files, thanks!", which is equivalent to how we have our configuration for tsconfig.json.

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems like a pretty good reason to me.

docusaurus/docs/importing-a-component.md Outdated Show resolved Hide resolved
@iansu
Copy link
Contributor

iansu commented Apr 19, 2019

Thank you for doing this. ❤️

"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to specify src here? I haven't tested, just wondering... if not, we could simplify this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for absolute imports. It’s used to specify which files should be included for TypeScript compilation and/or which files should be analyzed by the IDE.

@ianschmitz ianschmitz merged commit 2303b49 into facebook:master Apr 19, 2019
@ianschmitz ianschmitz deleted the jsconfig-docs branch April 19, 2019 14:27
@lock lock bot locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document usage of jsconfig.json
5 participants