- Newest
- Most votes
- Most comments
The TypeScript warnings you're experiencing in Cloud9 regarding the inability to find modules at '$lib/components' are likely due to the IDE's configuration not fully recognizing the SvelteKit project structure and its path aliases.
These warnings are indeed harmless if your build and dev scripts are running without issues. The problem is more related to the IDE's understanding of the project rather than actual issues with your code or configuration.
However, there are a few things you can try to address these warnings in Cloud9:
-
Make sure you have the latest version of the TypeScript extension installed in your Cloud9 environment.
-
Instead of modifying the '.svelte-kit/tsconfig.json' file (which gets automatically generated and shouldn't be manually edited), try adding a "paths" configuration to your root 'tsconfig.json' file:
{ "compilerOptions": { // ... other options ... "baseUrl": ".", "paths": { "$lib": ["src/lib"], "$lib/*": ["src/lib/*"] } } }
-
If you're using VS Code as your editor within Cloud9, you can try creating a 'jsconfig.json' file in the root of your project with similar path configurations:
{ "compilerOptions": { "baseUrl": ".", "paths": { "$lib": ["src/lib"], "$lib/*": ["src/lib/*"] } } }
-
Ensure that the TypeScript version used by your IDE matches the one used by your project. You can specify this in your 'tsconfig.json':
{ "compilerOptions": { // ... other options ... }, "typescript": { "version": "4.9.5" // or whatever version you're using } }
-
Try restarting the TypeScript server in your IDE. In VS Code, you can do this by opening the command palette (Ctrl+Shift+P or Cmd+Shift+P) and searching for "TypeScript: Restart TS Server".
If none of these solutions resolve the warnings, you may need to accept that they are indeed harmless IDE warnings and not actual issues with your code. As long as your application builds and runs correctly, these warnings shouldn't affect your development process significantly.
Sources
Enhanced TypeScript support and features - AWS Cloud9
Customize your project settings - AWS Cloud9
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a month ago
Thank you. I tried each suggestion except for the vs code because I do not use that - the warning persists. Additionally, I disabled jQuery in project settings. That did not help.
Ready to just accept as IDE bug BUT there is one thing that is curious. Import statement of CSS does not trigger a warning.
Ex. import "$lib/css/styles.styl"
This suggests that the environment typescript runner is getting tripped up by the brace section of the statement.
import { resource } from "$lib/ts/resource"