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.

webpack@2 and --env.dev: TypeError: Cannot convert undefined or null to object

See original GitHub issue

I am trying to use this new feature (found here https://gist.github.com/sokra/27b24881210b56bbaff7#configuration)

$ webpack-dev-server --inline --open --hot --env.dev

.../webpack.config.babel.js:29
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
                                                                                                                                                                                     ^

TypeError: Cannot convert undefined or null to object
    at Function.from (native)
    at _toConsumableArray (webpack.config.babel.js:7:1)
    at _default (webpack.config.babel.js:64:3)
    at module.exports (.../node_modules/webpack/bin/convert-argv.js:103:13)
    at Object.<anonymous> (.../node_modules/webpack-dev-server/bin/webpack-dev-server.js:115:48)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:148:18)
    at node.js:405:3

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sokracommented, Jun 13, 2016

I checked the spec and it’s correct that this is not supported. But you could do this:

...env.production && [
  // ...
] || []
// or
...env.production ? [
  // ...
] : []
0reactions
MoOxcommented, Jun 13, 2016

Indeed, that’s what I am doing! Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack-cli - TypeError: Cannot convert undefined or null to ...
All it is saying is that it expects an object of some type but it has null as the object may be set...
Read more >
【报Bug】vue create创建的项目webpack4报错TypeError
INFO Starting development server... ERROR TypeError: Cannot convert undefined or null to object TypeError: Cannot convert undefined or null ...
Read more >
npm err! cannot convert undefined or null to object - You.com
npm install returns "TypeError: Cannot convert undefined or null to object" ... cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch ...
Read more >
Npm update error "Cannot convert undefined or null to object"
node-red directory I get the error "Cannot convert undefined or null to object". The Idealtree seems to run to completion.
Read more >
Cannot convert undefined or null to object at Function.entries
This page uses a programList object provided by Wix that lists all the program. I noticed that whenever I get the concerned error...
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