Closed sergesemashko closed 8 years ago
@sergesemashko Version mismatching (particularly lodash) has presented issues with some of my projects as well.
Are you working with npm 2? I believe npm 3's flat dependency structure means you don't need to explicitly declare dependencies, and rely on universal-redux's dependencies instead. For example, the JWT example currently does not need to declare the dependencies you mention.
But that does not solve the issues I'm having where it appears UR does not always require the correct version between its dependencies and project level ones. I think adding UR's node_modules
to NODE_PATH
may have unintended consequences in the case where you wanted to use say an older version of lodash in your project. Then again, if UR specified project level node_modules
before its own, perhaps that point is moot.
@bdefore, I used npm 2 initially, but on npm@3 now and there are still cases when dependencies are not installed on “top” node_modules level, for example:
./A/node_modules/B/node_modules/D
./A/node_modules/C/node_modules/D
./A/node_modules/D
- not found, require('D')
from A fails2.In case A wants to use lower version of C:
./A/node_modules/C
, require('C')
from A returns an instance of C@1.0.0./A/node_modules/B/node_modules/C
./A/node_modules/universal-redux/node_modules
should be appended (not prepended) toNODE_PATH
to cover all the cases and avoid having the same dependencies already listed in universal-redux
. I understand, that this is a bad practice, but I'm not aware of any other solution.
In case of version mismatching in dependencies between project and universal-redux webpack bundles both versions for client, what would be good to avoid.
solved by adding ./node_modules/universal-redux/node_modules
to NODE_PATH
on the project. closing the issue
Hi there,
There are some small and not critical points regarding dependencies that are listed in
universal-redux
and project that uses it, but, I think, solving them would be a good optimization:universal-redux
) have to be explicitly defined at the project level;universal-redux
and the project;There won't be a need to list common dependencies(like react, redux, and so on) that are already defined in
universal-redux
by having./myProject/node_modules/universal-redux/node_modules
inNODE_PATH
. For example, https://github.com/bdefore/universal-redux-jwt/blob/master/package.json could get rid of:by having just
"universal-redux": "^3.0.0"
as a dependency.I understand, that the solution might be an anti-pattern, but wonder if it makes sense.
I used such approach in my own
universal-redux
-like package, and if there is any interest I would be glad to implement this.