Npm run build not working NEXTJS says TM undefined

Viewed 209

I am trying to run npm run build on my NextJs project. The terminal says:

info  - Loaded env from /mnt/c/Users/chloe/case4/2022-ca400-TEMPLATE/src/sage-project/.env.local
error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error

> Build error occurred
ReferenceError: withTM is not defined
    at Object.<anonymous> (/mnt/c/Users/chloe/case4/2022-ca400-TEMPLATE/src/sage-project/next.config.js:13:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:190:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)

and my next.config.js file looks like this:

/** @type {import('next').NextConfig} */
const withTM = require("next-transpile-modules")([
  "@fullcalendar/common",
  "@babel/preset-react",
  "@fullcalendar/common",
  "@fullcalendar/daygrid",
  "@fullcalendar/interaction",
  "@fullcalendar/react",
  "@fullcalendar/timegrid",
]);


module.exports = withTM({
 
  reactStrictMode: true
});

It says withTM isn't defined, but it is with const? Where am I going wrong?

0 Answers
Related