#Fresh Remix v2.4.1 installation -> ESLint: Unable to resolve path with tilde ~
1 messages · Page 1 of 1 (latest)
in your tsconfig, make sure you have the path alias set up
"paths": {
"#*": ["./*"],
if you've switched to ESM, you'll need to add the path extension to your import too
"~/NotFoundText.tsx"
Thank you Jacob. The path config in official remix templates tsconfig is:
"paths": { "~/*": ["./app/*"] },
unfortunately "~/NotFoundText.tsx" does not help either
The app works. It just seems to be an ESLint problem. Unfortunately very frustrating.
After a few hours of trying, I found the solution: You still have to install the package eslint-import-resolver-typescript, so:
npm install --save-dev eslint-import-resolver-typescript
Perhaps the problem does not occur when updating older installations, as this dependency is still present somewhere in the node_modules.
In my desperation, I even went through the Remix tutorial with different v2 versions from the beginning to realise that imports with ~ are not possible there either. Unfortunately, small errors like this can also put newcomers off Remix.
Can you push a PR to the templates to fix this?
I'm also seeing this error with a fresh Remix app. The app works fine, it seems to be an eslint error. Installing eslint-import-resolver-typescript did the trick (thanks @rocky egret !)
Hmm I’ve never used that package, but also I always use @typescript-eslint
Maybe that one does it automatically?
This is definitely just an eslint typescript thing. Just went through this with my own app as I moved from JSX to TSX. same conclusion as thomas. eslint-import-resolver-typescript works a charm, though requires a vscode restart for me
There’s an open issue/PR for this: https://github.com/remix-run/remix/issues/8336