vite-plugin-svelte-console-remover
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

vite-plugin-svelte-console-remover

npm npm bundle size GitHub last commit

A Vite plugin that removes all console statements (log, group, dir, error, etc) from Svelte, JS, and TS files during build so they don't leak into production.


What this doesn't do: This does not remove anything from your codebase. Your console.logs will still be there. You'll still see them in development and any other non-production environment.

What this does: Removes all console statements from appearing on your production domain. They're removed during the build/tranform step, so they're stripped out of your production code.

Example Use

import adapter from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess';
import removeConsole from 'vite-plugin-svelte-console-remover';

/** @type {import('@sveltejs/kit').Config} */
const config = {
	preprocess: preprocess(),
	kit: {
		adapter: adapter(),
		vite: {
			plugins: [removeConsole()],
		}
	}
}

export default config;

Package Sidebar

Install

npm i vite-plugin-svelte-console-remover

Weekly Downloads

76

Version

1.0.10

License

MIT

Unpacked Size

3.99 kB

Total Files

7

Last publish

Collaborators

  • jhubbardsf