Is the default for next.config.js's `removeConsole` false? If so, why are console.logs not in prod?
Unanswered
Harlequin posted this in #help-forum
HarlequinOP
Hello! What's the default value for
The property's mentioned here: https://nextjs.org/docs/architecture/nextjs-compiler#remove-console
But
so that may be something missing in documentation.
Thank you!
compiler.removeConsole in next.config.js?The property's mentioned here: https://nextjs.org/docs/architecture/nextjs-compiler#remove-console
But
compiler is not listed in options: https://nextjs.org/docs/pages/api-reference/next-config-jsso that may be something missing in documentation.
Thank you!
1 Reply
HarlequinOP
Looks unset here: https://github.com/vercel/next.js/blob/55fdfe4280c86932705c9ca87739187c23dec63f/packages/next/src/server/config-shared.ts#L637
And passed through here: https://github.com/vercel/next.js/blob/55fdfe4280c86932705c9ca87739187c23dec63f/packages/next/src/build/swc/options.ts#L137
https://github.com/vercel/next.js/blob/55fdfe4280c86932705c9ca87739187c23dec63f/packages/next/src/build/webpack-config.ts#L2676
Assuming that's all the case, then
And passed through here: https://github.com/vercel/next.js/blob/55fdfe4280c86932705c9ca87739187c23dec63f/packages/next/src/build/swc/options.ts#L137
https://github.com/vercel/next.js/blob/55fdfe4280c86932705c9ca87739187c23dec63f/packages/next/src/build/webpack-config.ts#L2676
Assuming that's all the case, then
removeConsole defaults to undefined, so I'd assume we don't remove console calls in production. Why aren't I seeing console.log in prod then?