Support setting baseUrl to root directory#7755
Support setting baseUrl to root directory#7755mrmckeb merged 1 commit intofacebook:masterfrom robertvansteen:baseurl-root
Conversation
|
Are there any known issues with the CI right now? Some of the failures ( |
|
Trying to fix CI. |
|
@rovansteen So at this stage we're not allowing people to configure aliases - maybe we can talk about that this week some more. I personally don't like aliases, but a lot of people love them... so it would be cool to get them in. |
|
@mrmckeb I agree, but I haven't had the time yet to properly research how aliases work in TypeScript as I have never used them personally. However this PR shouldn't get in the way of any future work on proper alias support, we just use aliases behind the scenes to prevent users from importing from any other directory than |
This PR adds support for setting the baseUrl in
tsconfig.json/jsconfig.jsonto the root directory (.).Initially I planned to add support for aliases but that turned out to be quite difficult due to difference in implementation between webpack and TypeScript. Instead this PR aims to facility the most requested option to import files with their absolute path (as seen from root) like
src/components/Button.js. (#6850)We don't want users to import from any directory other than
srcso the implementation maps a baseUrl of.to an alias that transformssrcto the absoluteappSrcdirectory. This should prevent users from doing something likeimport { something } from 'library/utils.js'..is allowed asbaseUrl