Skip to content

TypeError: config.watchOptions.ignored.filter is not a function or its return value is not iterable #77520

Closed
@ravi3222

Description

@ravi3222

Link to the code that reproduces this issue

https://github.com/vercel/next.js/tree/canary/examples

To Reproduce

1. npm run dev

CWA@1.0.0 dev
next dev

▲ Next.js 15.2.3

✓ Starting...
[TypeError: config.watchOptions.ignored.filter is not a function or its return value is not iterable]

2. npm run build

CWA@1.0.0 build
next build

▲ Next.js 15.2.3

  • Environments: .env.production, .env

Linting and checking validity of types ... ⨯ ESLint: Cannot read properties of undefined (reading 'replace') Occurred while linting CWA\src@kernel\components\Chip\Chip.tsx:15 Rule: "@next/next/no-before-interactive-script-outside-document"
✓ Linting and checking validity of types
Creating an optimized production build ...

Build error occurred
[TypeError: config.watchOptions.ignored.filter is not a function or its return value is not iterable]

=================================================

This is next.config.js

require("dotenv").config({ path: ./.env.${process.env.NODE_ENV} });

const path = require('path')

/** @type {import('next').NextConfig} */

const withTM = require('next-transpile-modules')([
//this triggers --> automatically enabled Fast Refresh for 1 custom loader
'@mui/material',
'@mui/system'
])

module.exports = withTM({
trailingSlash: true,
reactStrictMode: true,
output: 'standalone',
compiler: {
// Remove console.* output except console.error
removeConsole: {
exclude: ['error'],
},
// Uncomment this to suppress all logs.
// removeConsole: false,
},
env: {
ENVIRONMENT: process.env.ENVIRONMENT,
},
webpack: (config, { dev }) => {
config.resolve.alias = {
...config.resolve.alias
}
if (dev) {
config.watchOptions = {
poll: true,
}
return config
}

return config

}
})

Current vs. Expected behavior

current: frontend is providing compilation error
expected: frontend local server should be working

Provide environment information

Operating System:
      Platform: Windows
      Arch: x64
      Version: 11
    Binaries:
      Node: 20.11.0
      npm: 10.2.4
    Relevant packages:
      next: 15.2.3
      eslint-config-next: 15.2.3
      react: 19.0.0
      react-dom: 19.0.0
      typescript: 4.8.4

Which area(s) are affected? (Select all that apply)

Loading UI and Streaming, Webpack

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local)

Additional context

This error is coming after I am trying to upgrade nextjs from 13 to 15.
I used this to upgrade - npm i next@latest react@latest react-dom@latest eslint-config-next@latest
Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Loading UI and StreamingRelated to loading UI (loading.tsx) and streaming.WebpackRelated to Webpack with Next.js.invalid linkThe issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions