Subscribe on changes!

Custom formatter logging not works in Vue SFC Playground

avatar
Nov 25th 2023

They seem to work in development mode (click the PROD/DEV button). I'd imagine the custom formatters aren't included in a production build.

Or were you expecting the Playground to add them itself in production mode?

avatar
Nov 26th 2023

Oh it really works in DEV mode.

I'm not sure if SFC Playground should have a custom formatter added in PROD, because the default mode is PROD, and sometimes I just want to log some values there for testing. I would also like to hear other people's opinions.

avatar
Nov 27th 2023

After https://github.com/vuejs/core/commit/fc7902982a4bc9f0c9cdb0c9c222bc43a9d5c458 (which is a relatively recent change), the PROD flag now also uses the corresponding production build of Vue to best simulate production behavior. This means all dev-only logic, including warnings and custom formatter, is tree-shaken. So this is expected behavior.