#Fresh Remix v2.4.1 installation -> ESLint: Unable to resolve path with tilde ~

1 messages · Page 1 of 1 (latest)

rocky egret
#

I am trying to upgrade a perfectly working Remix v1 (1.19.3) website to v2 and am failing due to a number of minor issues. For example I can't even import modules via tilde v2 (2.4.1, Cloudflare Pages Template).
"ESLint: Unable to resolve path to module '~/NotFoundText'.(import/no-unresolved)"

hallow folio
rocky egret
#

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.

rocky egret
#

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.

hallow ice
#

Can you push a PR to the templates to fix this?

zinc crater
#

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 !)

hallow folio
#

Maybe that one does it automatically?

mortal tide
#

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

main turret