Common Next.js errorsreplaceAll called with a non-global RegExp
TypeError: String.prototype.replaceAll called with a non-global RegExp argument (Node.js and Chrome) or replaceAll must be called with a global RegExp (Firefox) means replaceAll was given a regular expression without the g flag. Unlike replace, it refuses.
How to fix it
slug.replaceAll("-", " "); // a plain string: simplest
slug.replaceAll(/-/g, " "); // a global regular expression
slug.replace(/-/g, " "); // replace with the g flag
A plain string is usually what you meant, and it can't go wrong with special characters.