It seems that it expects a list of ignored patterns on watchOptions. This breaks with the latest change in the Next.js code which I have referenced below. So apparently, they have replaced the list of strings with a Regex pattern:
Install the next-transpile-modules and add it to the next config file
Run next dev or next build and the error message should appear
Expected behavior
It is expected for the build to succeed and not throw this error, because the webpack-config is not configurable/changable before getting to the module
Setup
Next.js version: 13.4.9
next-transpile-modules version: 10.0.0
Node.js version: 18
npm/yarn version: 1.22.19
Operating System: MacOS Ventura
Webpack 4
Debug logs (optiona)
TypeError: config.watchOptions.ignored.filter is not a function or its return value is not iterable
at Object.webpack (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next-transpile-modules/src/next-transpile-modules.js:266:42)
at Object.newWebpackFunction [as webpack] (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/@sentry/nextjs/cjs/config/webpack.js:66:37)
at getBaseWebpackConfig (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next/dist/build/webpack-config.js:2152:32)
at async Promise.all (index 0)
at async Span.traceAsyncFn (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next/dist/trace/trace.js:103:20)
at async Span.traceAsyncFn (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next/dist/trace/trace.js:103:20)
at async HotReloader.start (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next/dist/server/dev/hot-reloader.js:573:30)
at async DevServer.prepareImpl (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next/dist/server/dev/next-dev-server.js:683:9)
at async NextServer.prepare (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next/dist/server/next.js:165:13)
at async Server.<anonymous> (/Users/ardeshireshghi/workspace/givver-org/givver-web/node_modules/next/dist/server/lib/render-server.js:128:17) {
type: 'TypeError'
}
Additional context
Add any other context about the problem here.
Are you trying to transpile a local package or an npm package? If an npm package, which one?
Describe the bug I am trying to build or run a Next.js app locally. When I try to run it, I receive the message referenced in the debug logs
I dig a bit deeper into the issue and came across this file next-transpile-modules.js. There is a line that says:
It seems that it expects a list of ignored patterns on
watchOptions
. This breaks with the latest change in the Next.js code which I have referenced below. So apparently, they have replaced the list of strings with a Regex pattern:https://github.com/vercel/next.js/pull/52238/files
To Reproduce Steps to reproduce the behavior (a reproduction is even better):
npx create-next-app@latest
next-transpile-modules
and add it to the next config filenext dev
ornext build
and the error message should appearExpected behavior It is expected for the build to succeed and not throw this error, because the
webpack-config
is not configurable/changable before getting to the moduleSetup
next-transpile-modules
version: 10.0.0npm
/yarn
version: 1.22.19Debug logs (optiona)
Additional context Add any other context about the problem here.