TypeError: dependency.getCondition is not a function
See original GitHub issueDescribe the bug
Cannot build the application on the latest version (5.0.0)
Did you try recovering your dependencies?
Yes.
Which terms did you search for in User Guide?
N/A
Environment
Environment Info:
current version of create-react-app: 5.0.0
running from /home/.nvm/versions/node/v16.5.0/lib/node_modules/create-react-app
System:
OS: macOS 12.1
CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
Binaries:
Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
Yarn: Not Found
npm: 7.19.1 - ~/.nvm/versions/node/v16.5.0/bin/npm
Browsers:
Chrome: 96.0.4664.110
Edge: Not Found
Firefox: Not Found
Safari: 15.2
npmPackages:
react: ^16.13.1 => 16.14.0
react-dom: ^16.13.1 => 16.14.0
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: 5.0.0
Steps to reproduce
- react-scripts start
Expected behavior
Should build the application with success.
Actual behavior
Creating an optimized production build...
(node:40391) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
(Use `node --trace-deprecation ...` to show where the warning was created)
<path>/node_modules/react-scripts/scripts/build.js:19
throw err;
^
TypeError: dependency.getCondition is not a function
at ModuleGraph.setResolvedModule (<path>/node_modules/react-scripts/node_modules/webpack/lib/ModuleGraph.js:196:15)
at <path>/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1845:20
at <path>/node_modules/react-scripts/node_modules/webpack/lib/util/AsyncQueue.js:352:5
at Hook.eval [as callAsync] (eval at create (<path>/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<path>/node_modules/react-scripts/node_modules/tapable/lib/Hook.js:18:14)
at AsyncQueue._handleResult (<path>/node_modules/react-scripts/node_modules/webpack/lib/util/AsyncQueue.js:322:21)
at <path>/node_modules/react-scripts/node_modules/webpack/lib/util/AsyncQueue.js:305:11
at <path>/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1299:4
at <path>/node_modules/react-scripts/node_modules/webpack/lib/Cache.js:85:6
at <path>/node_modules/react-scripts/node_modules/webpack/lib/Cache.js:39:11
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:9
Top Results From Across the Web
withServiceWorker webpack5 issue in Next.js
getCondition(this) ^ TypeError: dependency.getCondition is not a function at ModuleGraph.setResolvedModule (/Users/ajay/Documents/code/the-pull- ...
Read more >Reactjs App cannot build due to some dependency issue
getCondition is not a function at ModuleGraph.setResolvedModule (/Users/example_app/node_modules/react-scripts/node_modules/webpack/lib/ ...
Read more >React, how to fix the TypeError: resolver is not a function error
Turned out the solution was very simple. So, make sure you have a default export and the error will go away.
Read more >compilation.hooks.normalmoduleloader was moved to ...
js:19 throw err; ^ TypeError: dependency.getCondition is not a function at ModuleGraph.setResolvedModule (/Users/example_app/node_modules/react- ...
Read more >gclient.py - chromium/tools/depot_tools - Git at Google
allow_dicts indicates if this function will allow converting dictionaries ... 'managed' determines whether or not this dependency is synced/updated by.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For me I had to explicitly add
webpack@5
as a dependency. Storybook default hardcodes Webpack v4 and CRA allows v4 to be used as a dependency so it got hoisted (I’m using a lerna monorepo).https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#wrong-webpack-version
I think CRA should enforce Webpack 5+.
Just if it helps. If I remove my service-worker.ts file then everything works as expected. (No matter the content inside service-worker.ts)
I needed it since we are using it in our webapp. Will keep investigating.