diff --git a/vite.config.js b/vite.config.js index c0ca3647..fce5bf57 100644 --- a/vite.config.js +++ b/vite.config.js @@ -5,7 +5,7 @@ import { } from 'vite'; import tailwindcss from "@tailwindcss/vite"; -export default defineConfig({ +export default defineConfig(({ mode }) => ({ plugins: [ laravel({ input: ['resources/css/app.css', 'resources/js/app.tsx'], @@ -17,6 +17,25 @@ export default defineConfig({ ], esbuild: { jsx: 'automatic', + + // Keep other people's development warnings out of our users' + // consoles. React strips its own from a production build; several + // of our dependencies do not — Radix emits an accessibility + // warning on every dialog it considers underdescribed, and it + // reaches anyone who opens devtools on a real installation. A + // warning aimed at whoever is building the software is noise to + // whoever is using it, and noise is where real errors go to hide. + // + // console.error is deliberately NOT in this list. Something has + // genuinely gone wrong when it fires, and a support conversation + // that starts with a real stack trace is worth more than a tidy + // console. This only strips the levels that are advisory. + // + // Development is untouched: `npm run dev` still shows everything, + // which is where those warnings are actually useful. + pure: mode === 'production' + ? ['console.log', 'console.warn', 'console.info', 'console.debug', 'console.trace'] + : [], }, resolve: { // Package pages (packages/*/resources/js) are loaded through a @@ -28,4 +47,4 @@ export default defineConfig({ // path instead, whose ancestry does. preserveSymlinks: true, }, -}); \ No newline at end of file +})); \ No newline at end of file