docz: Failed to compile, can't resolve dom-helpers modules
Got docz installed on existing UI library, trying to run docz dev with no mdx files at all
Got this error while bundling:
ERROR Failed to compile with 5 errors 10:55:41 AM
These dependencies were not found:
⠀
* dom-helpers/events/off in ../node_modules/scroll-behavior/lib/index.js
* dom-helpers/events/on in ../node_modules/scroll-behavior/lib/index.js
* dom-helpers/query/scrollLeft in ../node_modules/scroll-behavior/lib/index.js
* dom-helpers/query/scrollTop in ../node_modules/scroll-behavior/lib/index.js
* dom-helpers/util/requestAnimationFrame in ../node_modules/scroll-behavior/lib/index.js
Seems that it is some kind of versioning issue: node_modules in ./.docz contains dom-helpers v5, which has no such exports unlike v3 which probably should be resolved and installed
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 21 (7 by maintainers)
Commits related to this issue
- fix(gatsby-theme-docz): fix faulty webpack resolution #1102 by @aleksandervalle — committed to doczjs/docz by rakannimer 5 years ago
I have fixed that by adding “resolutions”: { “dom-helpers”: “3.4.0” },
Update: It actually brokes react-transition-group dependency of dom-helpers “5.1.3”, and unfortunately even such “resolutions” doesn’t work:
yarn.lock seems to be correct (?), but still not working.
Update 2: Finally get it working by patching my project, not ideal I think (ideal would be fix in docz?), but both my project and docz working simultaneously.
dom-helpers@3.4.0
for doczyarn add dom-helpers@3.4.0 -D
yarn add dom-helpers5@npm:dom-helpers@5.1.3 -D
resolve: { ... alias: { 'dom-helpers': 'dom-helpers5' } },
I am also facing same issue with
create-next-app
Withmaterial-ui
anddocz
together.. Then I tried using
npx create-docz-app my-docz-app
. And addedyarn add @material-ui/core
and I am facing samedom-helper
issue.yarn.lock
gatsby-react-router-scroll > scroll-behavior > dom-helpers "^3.2.1"
@material-ui/core@^4.6.1 > react-transition-group > dom-helpers "^5.0.1"
@barbalex @rakannimer any solution or way around temp fix ?
@rakannimer I don’t see anything wrong with dependencies. Conflicting ones are nested in packages properly. But for some reason docz resolver finds only dom-helpers from the root. https://github.com/react-bootstrap/dom-helpers/issues/51#issuecomment-531236558
Thanks @aleksandervalle 😃
The issue should be fixed in
2.0.0-rc.77
👍Going to close this issue, please comment here if the problem re-occurs.
Nice catch @aleksandervalle ! I was able to reproduce and it works indeed.
The code is a remnant from an old version of docz.
I’ll remove it and publish the last release candidate before the 2.0 version later today.
Installed material-ui/core on a pretty fresh docz-install, and getting same error – conflicting versions of dom-helpers.
After reading https://github.com/webpack/webpack/issues/6538, I tried commenting out this whole if-statement (https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/lib/onCreateWebpackConfig.js#L23):
I’ll admit ignorance to webpack module resolution, but seems to me that things are resolving fine, i.e. things seem to be working.
@rakannimer Superb. Docz is fantastic, thanks for doing an awesome job! 😃
Bump of Rahuls comment, I am also receiving the same issue using
create-react-app
,material-ui/core
anddocz
together.EDIT: I resolved my issue by deleting my NODE_MODULES, yarn.lock and doing a fresh yarn install, after that I was given a “could not resolve docz-theme-default” error, which was resolved by doing a yarn add docz-theme-default, after which docz worked as expected.