Next.js · Senior · Question 17 of 75
When do you need the serverExternalPackages option?
- ✓Correct answer: When a server package can't be bundled, e.g. one with native modules
- 2When you need to load React and React DOM as a separate CDN script
- 3When a package is used only in the browser and isn't needed on the server
Explanation
By default, Next.js bundles the dependencies of server code. Some packages (with native bindings, dynamic requires, large binaries) break when bundled - they're marked as external and loaded from node_modules at runtime. Popular cases are already on the default list.