recharts / babel-plugin-recharts

MIT License
117 stars 16 forks source link

doesn't work with next | paths.join is not a function #11

Open pixelass opened 4 years ago

pixelass commented 4 years ago

When using this with next.js I get the following error:

[ error ] ./pages/_app.tsx
[1] TypeError: paths.join is not a function
[1]     at Array.forEach (<anonymous>)
[1]     at Array.map (<anonymous>)
[1] [ wait ]  compiling ...
[1] > Client ready on http://localhost:3000
[1] [ error ] ./node_modules/next/dist/client/next-dev.js
[1] TypeError: paths.join is not a function
[1]     at Array.forEach (<anonymous>)
[1]     at Array.map (<anonymous>)
[1] [ wait ]  compiling ...
[1] [ error ] ./node_modules/next/dist/client/next-dev.js
[1] TypeError: paths.join is not a function
[1]     at Array.forEach (<anonymous>)
[1]     at Array.map (<anonymous>)
[1] [ wait ]  compiling ...
[1] [ error ] ./node_modules/next/dist/client/next-dev.js
[1] TypeError: paths.join is not a function
[1]     at Array.forEach (<anonymous>)
[1]     at Array.map (<anonymous>)
juanfrnz commented 4 years ago

Order matters when declaring babel plugins. Did you configure using .babelrc? Try adding the babel-plugin-recharts at the end of the plugins list. A working example would be:

{
  "presets": ["next/babel"],
  "plugins": [
    [
      "styled-components",
      { "ssr": true, "displayName": true, "preprocess": false },
      "babel-plugin-recharts"
    ]
  ]
}