SHIV5T3R / CO-DE

An Open Source Collaborative Code Editor
36 stars 26 forks source link

config: setup vite and tsconfig import aliases correctly and correct … #31

Closed KingXP-Pythoner closed 11 months ago

KingXP-Pythoner commented 11 months ago

This PR fixes alias configuration in the vite config and ts configuration files. This alllows us to import easily, consistency across codebase and vscode intellisense. There are two ways you may import files:

  1. add a '@/' before the file and the configuration resolves them to ./src/*. For example, 'components' is a folder inside src. To import a file from 'components' folder, you may do this: import MyComponent from '@/components/ui/MyComponent
  2. the folder name directly. For example, 'components' is a folder inside src. To import a file from 'components' folder, you may do this: import MyComponent from 'components/ui/MyComponent'

I'd advise to use the 2nd way of imports going forward so that if we use any 3rd party packages with imports that have '@' , it reduces confusion. This PR also takes the fix from pending PR #27 by @believemanasseh which corrects the jest import for the test setup file.