I have been using create-react-app for a long time, and decided to try out vite.
In webpack, instead of importing a file as follows:
import Appbar from '../../../../../../../../../../components/Appbar'
I can directly import it as:
import Appbar from 'components/Appbar'
the way I used to do it is by making a file in the project root directory called jsconfig.json
, and I write the following:
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
This makes webpack think that the root directory is the src directory.
How to make the same thing with vite? vite uses roll-up, but I couldn't find a question as mine, so I decided to ask a new one.