You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I asked this question on stack overflow as well, but thought I'd try to raise more awareness here too. My motivation behind this discussion is from a position of ignorance and I'd like to correct that ignorance by understanding a bit more than I currently know.
So I'd like to know for NX libs, why module boundaries are enforced through a public API (everything that gets exported from the libraries' index.js). I can understand the general benefits of proper modules boundaries such as:
better organization through colocation or similar file location
possibly easier for code splitting
But to attain these general benefits, I'm not sure if module boundaries must be enforced through a public API. For larger teams and monorepos that contain multi-platform projects or multi-purposes projects, I can see more strict control might be necessary, but for smaller teams and with more single-purpose projects, I'm not sure if as strict control is needed.
To be clear, the "control" I'm specifically referring to is the eslint rule nx-enforce-module-boundaries and requiring public APIs only be exposed through index.js instead of importing files/methods directly (refer to the code sample in the SO question)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I asked this question on stack overflow as well, but thought I'd try to raise more awareness here too. My motivation behind this discussion is from a position of ignorance and I'd like to correct that ignorance by understanding a bit more than I currently know.
So I'd like to know for NX libs, why module boundaries are enforced through a public API (everything that gets exported from the libraries'
index.js
). I can understand the general benefits of proper modules boundaries such as:But to attain these general benefits, I'm not sure if module boundaries must be enforced through a public API. For larger teams and monorepos that contain multi-platform projects or multi-purposes projects, I can see more strict control might be necessary, but for smaller teams and with more single-purpose projects, I'm not sure if as strict control is needed.
To be clear, the "control" I'm specifically referring to is the eslint rule
nx-enforce-module-boundaries
and requiring public APIs only be exposed throughindex.js
instead of importing files/methods directly (refer to the code sample in the SO question)Beta Was this translation helpful? Give feedback.
All reactions