Viraj
Viraj

Reputation: 797

ReferenceError: exports is not defined error in Next.js

I am seeing the following error with react-datetime-picker v3.5.0 and Next.js.

Unhandled Runtime Error
ReferenceError: exports is not defined

Call Stack
eval
node_modules/react-datetime-picker/dist/DateTimePicker.js (8:0)
./node_modules/react-datetime-picker/dist/DateTimePicker.js
...
/_next/static/chunks/webpack.js (718:31)

In next.config.js I have:

const withTM = require('next-transpile-modules')(['react-datetime-picker']); // pass the modules you would like to see transpiled
module.exports = withTM(nextConfig)

Upvotes: 1

Views: 2659

Answers (1)

juliomalves
juliomalves

Reputation: 50288

Looks related to a bug introduced in the v12.2.0 release. See related GitHub issue: https://github.com/vercel/next.js/issues/38117.

You should downgrade Next.js to v12.1.6 for now.

Upvotes: 2

Related Questions