Created by: rovansteen
This PR adds support for setting the baseUrl in tsconfig.json
/jsconfig.json
to 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
. (https://github.com/facebook/create-react-app/issues/6850)
We don't want users to import from any directory other than src
so the implementation maps a baseUrl of .
to an alias that transforms src
to the absolute appSrc
directory. This should prevent users from doing something like import { something } from 'library/utils.js'
.
-
Update error message to communicate that .
is allowed asbaseUrl