Next.js Discord

Discord Forum

__webpack_require__.n is not a function

Answered
Shayokh posted this in #help-forum
Open in Discord
I am trying to use a bar chart from Shadcn. I have installed shadcn and added the bar chart code from their docs. But when I run the code and go to /stats for the very first time, I am getting this error. But when I refresh the /stats page, the error is gone forever.

How to fix it?
Answered by Japanese Bobtail
i ran into similar issue and solved after adding this line to package.json:
 "type": "module",
View full answer

6 Replies

stats page -
import { BarChartNegative } from "./BarChart";

export default function Page() {
  return <BarChartNegative />;
}
Japanese Bobtail
i ran into similar issue and solved after adding this line to package.json:
 "type": "module",
Answer
You saved my day!
❤️