Babel-plugin-module-resolver: Error: pluginOpts.root.reduce is not a function

Created on 2 Apr 2017  路  2Comments  路  Source: tleunen/babel-plugin-module-resolver

I found error

node_modules/babel-plugin-module-resolver/lib/index.js:67
    pluginOpts.root = pluginOpts.root.reduce(function (resolvedDirs, dirPath) {

Here's my .babelrc config

{
  "presets": [
    "next/babel",
    "latest",
    "stage-2"
  ],
  "plugins": [
    ["module-resolver", {
      "root": "./src",
      "alias": {
        "@": "./"
      }
    }]
  ]
}

Most helpful comment

ah, my bad. missing [] on my root key

All 2 comments

ah, my bad. missing [] on my root key

To save everyone else the click, the readme documents the following way to configure the plugin:

["module-resolver", {
  "root": ["./src"],
  "alias": {
    "@": "./"
  }
}]
Was this page helpful?
0 / 5 - 0 ratings