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.

Error: .plugins[0][1] must be an object, false, or undefined

See original GitHub issue

I’ve updated Next from version 5 to 6 and on build I get:

Error: .plugins[4][1] must be an object, false, or undefined
    at assertPluginItem (/node_modules/@babel/core/lib/config/validation/option-assertions.js:157:15)
    at /node_modules/@babel/core/lib/config/validation/option-assertions.js:134:14
    at Array.forEach (<anonymous>)
    at assertPluginList (/node_modules/@babel/core/lib/config/validation/option-assertions.js:133:9)
    at /node_modules/@babel/core/lib/config/validation/options.js:84:20
    at Array.forEach (<anonymous>)
    at validate (/node_modules/@babel/core/lib/config/validation/options.js:62:21)
    at /node_modules/@babel/core/lib/config/config-chain.js:141:36
    at cachedFunction (/node_modules/@babel/core/lib/config/caching.js:40:17)
    at init (/node_modules/@babel/core/lib/config/config-chain.js:122:12)
    at /node_modules/@babel/core/lib/config/config-chain.js:206:17
    at buildRootChain (/node_modules/@babel/core/lib/config/config-chain.js:85:20)
    at loadPrivatePartialConfig (/node_modules/@babel/core/lib/config/partial.js:41:53)
    at loadPartialConfig (/node_modules/@babel/core/lib/config/partial.js:66:16)
    at babelConfig (/node_modules/next/dist/server/build/webpack.js:88:57)
    at _callee2$ (/node_modules/next/dist/server/build/webpack.js:164:34)

My babel deps are:

    "babel-eslint": "^8.2.3",
    "babel-plugin-inline-react-svg": "^0.5.2",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-env": "^1.6.1",
    "babel-root-import": "^4.1.8",
    "markdown-in-js": "1.1.4",

.babelrc

{
  "presets": [
    "env",
    "next/babel"
  ],
  "plugins": [
    "markdown-in-js/babel",
    "inline-react-svg",
    "transform-decorators-legacy",
    "transform-class-properties",
    ["babel-root-import", [{
      "rootPathPrefix": "~",
      "rootPathSuffix": "."
    }, {
      "rootPathPrefix": "$",
      "rootPathSuffix": "app"
    }, {
      "rootPathPrefix": "#",
      "rootPathSuffix": "shared"
    }]]
  ]
}

Tech Version
next 6
node v8.9.3
OS macOS H.S.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
brentmclarkcommented, Oct 16, 2018

@foxhound87 did babel-upgrade install babel-core": "^7.0.0-bridge.0? I don’t see it in your list, and I’m pretty sure it’s absence will muck with the non-scoped packages (e.g. babel-eslint)

2reactions
foxhound87commented, Oct 3, 2018

I updated to next 7 and the babel deps using babel-upgrade, the app is building and running correctly locally (also in docker container, using nanobox), but when deployed (same environment) I get the usual error:

Module build failed (from ./node_modules/next/dist/build/webpack/loaders/next-babel-loader.js):
 Error: .plugins[0][1] must be an object, false, or undefined

This is my new babel.config.js:

module.exports = {
  presets: [
    'next/babel',
  ],
  plugins: [
    'markdown-in-js/babel',
    'inline-react-svg',
    ['@babel/plugin-proposal-decorators', { legacy: true }],
    ['@babel/plugin-proposal-class-properties', { loose: true }],
  ],
};

I’m not using all the plugins installed by babel-upgrade. Just what I need.

the packages installed by babel-upgrade in devDependencies are:

    "@babel/core": "^7.1.2",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-decorators": "^7.0.0",
    "@babel/plugin-proposal-do-expressions": "^7.0.0",
    "@babel/plugin-proposal-export-default-from": "^7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-function-bind": "^7.0.0",
    "@babel/plugin-proposal-function-sent": "^7.0.0",
    "@babel/plugin-proposal-json-strings": "^7.0.0",
    "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
    "@babel/plugin-proposal-numeric-separator": "^7.0.0",
    "@babel/plugin-proposal-optional-chaining": "^7.0.0",
    "@babel/plugin-proposal-pipeline-operator": "^7.0.0",
    "@babel/plugin-proposal-throw-expressions": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/preset-env": "^7.1.0",
    "babel-eslint": "^10.0.1",
    "babel-loader": "^8.0.4",
    "babel-plugin-inline-react-svg": "^0.5.4",

really can’t understand what’s still wrong! This error is still preventing me to update next. I also reduced the number of the plugins used in the babel config file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugins[0][1] must be an object, false, or undefined
I suspect the issue is related to the .babelrc file as it is a babel-loader error being thrown. .babelrc { "presets": [ ], ......
Read more >
build failed due to babelrc, presets[0] [1] must be an object ...
Coding example for the question build failed due to babelrc, presets[0] [1] must be an object, false or undefined-babel.js.
Read more >
Error: .plugins[0][1] must be an object, false, or undefined
vue2.0+按需引入element-ui报错项目使用vue脚手架自动生成的,vue版本为^2.5.16.项目中需要按需使用element-ui,根据element-ui的官方文档, ...
Read more >
Error: .plugins[0][1] must be an object, false, or undefined
vue2.0+按需引入element-ui报错项目使用vue脚手架自动生成的,vue版本为^2.5.16.项目中需要按需使用element-ui,根据element-ui的官方文档, ...
Read more >
Console error "WeakMap key must be an object, got ...
I'm seeing this error in the browser console, it appears to happen every time a new tab is created: WeakMap key must be...
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