question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

whenDev, whenCI is not a function or its return value is not iterable

See original GitHub issue

I am getting the following error when using when, whenDev and whenCI functions in craco.config.js

TypeError: whenDev(...) is not a function or its return value is not iterable
    at Object.<anonymous> (/Users/asantikari/Documents/git/sc-spike/new-cart/craco.config.js:22:10)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at loadCracoConfig (/Users/asantikari/Documents/git/sc-spike/new-cart/node_modules/@craco/craco/lib/config.js:48:20)
    at Object.<anonymous> (/Users/asantikari/Documents/git/sc-spike/new-cart/node_modules/@craco/craco/scripts/build.js:16:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

My config looks like this.

module.exports = {
	webpack: {
  	plugins: [
      ...whenDev(() => [
        new BundleAnalyzerPlugin({
          analyzerMode: 'static',
          reportFilename: '../bundle-stats/report.html',
          openAnalyzer: false,
          logLevel: 'error',
        }),
      ]),
    ],
  }
}

CRACO Version: 3.2.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
patricklafrancecommented, Sep 17, 2019

Hi @ashishsantikari

Everything seems fine for whenDev, do you have a repro case?

As for whenCI, sorry I meant to remove it in a previous release but I didn’t see it through and the documentation hasn’t been updated accordingly. The updated documentation will be release soon.

You can find an alternative here: https://github.com/sharegate/craco/blob/master/changelog/5.5.0.md

Thank you,

Patrick

1reaction
ashishsantikaricommented, Sep 17, 2019

@patricklafrance I am able to make it work now. It’s too complicated to debug problems in craco config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

whenDev, whenCI is not a function or its return value ... - GitHub
I am getting the following error when using when, whenDev and whenCI functions in craco.config.js TypeError: whenDev(...) is not a function ...
Read more >
The meaning of "'x' is not a function or its return value is not ...
Yes, there is meaning to both parts of the error message. In the case you have at hand, the return value of Symbol()...
Read more >
object is not a function or its return value is not iterable
I have a small React hook that is wrapping a class component and I am trying to pass a state from this hook...
Read more >
TypeError: 'x' is not iterable - JavaScript - MDN Web Docs
The JavaScript exception "is not iterable" occurs when the value which is given as the right-hand side of for...of, as argument of a...
Read more >
is not a function or its return value is not iterable in ReactJs ...
TypeError: react__WEBPACK_IMPORTED_MODULE_0_default is not a function or its return value is not iterable 1 | import useState from 'react'; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found