remix-utils: missing type declarations (regression)
rolanday opened this issue · 9 comments
Describe the bug
Latest version of remix-util is broke for me (cannot import from). A clean remix-install results in following when attempting to import:
app/routes/_index.tsx:1:36 - error TS2307: Cannot find module 'remix-utils' or its corresponding type declarations.
1 import { getClientIPAddress } from "remix-utils";
~~~~~~~~~~~~~
Found 1 error in app/routes/_index.tsx:1
Repro avail here: https://github.com/rolanday/repro-remix-util
Same result using bun and npm package managers
Your Example Website or App
https://github.com/rolanday/repro-remix-util
Steps to Reproduce the Bug or Issue
- Create new remix project (typescript)
npm i remix-utils
- Try to import
remix-utils
- Note cannot find module error
Expected behavior
To be able to import from remix-utils
Screenshots or Videos
No response
Platform
- OS: macOS (Sonoma v14.0)
- Browser: N/A
Additional context
No response
This is mentioned on the Upgrade from Remix Utils v6 section of the README, specifically on the Updated Import Paths section
Thank you. My bad for not checking most obvious place (readme) for solution.
@brandonpittman did you added "moduleResolution": "Bundler"
to tsconfig.json
?
If TS doesn't allow moduleResolution to be Bundler then you're not on TS v5.
And latest Remix Utils version needs Remix v2, if you're still in v1 it's better to stick with Remix Utils v6.
@sergiodxa Sorry. It wound up being a problem with my editor extension for tsserver being too older to work with TSv5 and the bundler
setting. 🙇🏻
@sergiodxa I am trying to upgrade a project to Remix v2 and remix-utils to v7 as well. Also facing TS error. We are on
"module": "CommonJS",
"moduleResolution": "node"
and I am hesitant to make this an even bigger change (had to upgrade pretty much every dependency as well as Node). Is there a way around this issue?
@lananelson you need to change your tsconfig module resolution to Bundler.