plotly / react-pivottable

React-based drag'n'drop pivot table with Plotly.js charts
https://react-pivottable.js.org/
MIT License
972 stars 248 forks source link

TypeError: t.hasOwnProperty is not a function #169

Open YaokunLin opened 5 months ago

YaokunLin commented 5 months ago

Hi got

`TypeError: t.hasOwnProperty is not a function at /home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:1:8273 at 3912 (/home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:5:13264) at t (/home/user/Repos/next-auth-example/.next/server/webpack-runtime.js:1:128) at 9683 (/home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:5:15263) at t (/home/user/Repos/next-auth-example/.next/server/webpack-runtime.js:1:128) at 1189 (/home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:1:2769) at t (/home/user/Repos/next-auth-example/.next/server/webpack-runtime.js:1:128) at F (/home/user/Repos/next-auth-example/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:91937) at /home/user/Repos/next-auth-example/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94352 at W._fromJSON (/home/user/Repos/next-auth-example/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94790)

Error occurred prerendering page "/resource-mgn-pivot". Read more: https://nextjs.org/docs/messages/prerender-error TypeError: t.hasOwnProperty is not a function at /home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:1:8273 at 3912 (/home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:5:13264) at t (/home/user/Repos/next-auth-example/.next/server/webpack-runtime.js:1:128) at 9683 (/home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:5:15263) at t (/home/user/Repos/next-auth-example/.next/server/webpack-runtime.js:1:128) at 1189 (/home/user/Repos/next-auth-example/.next/server/app/resource-mgn-pivot/page.js:1:2769) at t (/home/user/Repos/next-auth-example/.next/server/webpack-runtime.js:1:128) at F (/home/user/Repos/next-auth-example/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:91937) at /home/user/Repos/next-auth-example/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94352 ✓ Generating static pages (15/15) `

When trying to build the app under Next.js 14.0.4, not sure if you guys saw this build error before. I think this came from that the latest react-pivottable is not compatible, packages shows here

` "dependencies": { "@radix-ui/react-avatar": "^1.0.3", "@radix-ui/react-collapsible": "^1.0.3", "@radix-ui/react-dropdown-menu": "^2.0.5", "@radix-ui/react-navigation-menu": "^1.1.3", "@radix-ui/react-slot": "^1.0.2", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "lucide-react": "^0.274.0", "next": "latest", "next-auth": "beta", "react": "^18.2.0", "react-dom": "^18.2.0", "react-pivottable": "^0.11.0", "tailwind-merge": "^1.14.0", "tailwindcss-animate": "^1.0.7" },

"devDependencies": { "@types/node": "^18", "@types/react": "^18.2.23", "@types/react-dom": "^18.2.8", "@types/react-pivottable": "^0.11.5", "@types/react-table": "^7.7.19", "autoprefixer": "^10.4.15", "postcss": "^8.4.29", "tailwindcss": "^3.3.3", "typescript": "^5.2.2" }`

image

any help would be greatly appreciated. thanks

fsmaestro commented 2 months ago

That error occurred because the rendering of the following code used for pivot table. import("react-plotly.js");

import dynamic from "next/dynamic"; const Plot = dynamic(() => import("react-plotly.js"), { ssr: false });

I used dynamic for import clause, and it works!