remix
remix copied to clipboard
importing sibling module via index results in unresolved dependency (undefined)
What version of Remix are you using?
1.1.1
What version of Node are you using? Minimum supported version is 14.
14.15.0
Steps to Reproduce
Open and run dev
the following:
https://stackblitz.com/edit/github-gqhf1n-zbcsjo
It should instantly fail with TypeError: Cannot read properties of undefined (reading 'omit')
breaking through all error boundaries.
Notes:
- in
routes/index.tsx
: import { doStuff } from '~/module'; - in
module/index.ts
: export * from./b
and./a
, the order is important! (b
first) - in
module/b.ts
: it imports from./a
via index (~/module
)
AFAIK esmodule-wise this is not an error and schould work, since its static and I do not use circular import. I think compilation fails due to being confused importing something via the same index as its sibling. Order makes a difference, when a is exported first in index, error goes away. Also when not importing via index.
This is a problem, because relative imports in 95% are a problem. So I always run vsc with non-relative. I think many will do this to make refactoring and moving things easier. Also with import-optimization runs, its ordered and hence this error will randomly trigger based on file name and order.
Expected Behavior
no TypeError
Actual Behavior
TypeError
Hey @akomm, Is this still a problem on Remix 1.11.1 ?
This issue has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from issues that are unactionable. Please reach out if you have more information for us! 🙂