<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ctjj</title>
    <description>The latest articles on DEV Community by ctjj (@ctjj_e0ca65f340e2d82720d4).</description>
    <link>https://dev.to/ctjj_e0ca65f340e2d82720d4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2256370%2F0487c5bf-0c58-4d9c-a101-9b01985b012b.png</url>
      <title>DEV Community: ctjj</title>
      <link>https://dev.to/ctjj_e0ca65f340e2d82720d4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ctjj_e0ca65f340e2d82720d4"/>
    <language>en</language>
    <item>
      <title>Remove console statements from other developers and keep only your own!</title>
      <dc:creator>ctjj</dc:creator>
      <pubDate>Tue, 19 Aug 2025 06:28:57 +0000</pubDate>
      <link>https://dev.to/ctjj_e0ca65f340e2d82720d4/remove-console-statements-from-other-developers-and-keep-only-your-own-i96</link>
      <guid>https://dev.to/ctjj_e0ca65f340e2d82720d4/remove-console-statements-from-other-developers-and-keep-only-your-own-i96</guid>
      <description>&lt;p&gt;As developers, I believe everyone must have encountered a lot of logs in the console, which greatly reduces our development efficiency&lt;/p&gt;

&lt;p&gt;Now, I recommend a self-developed Vite plugin that can remove logs not belonging to the user during packaging based on the git author information&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mmdctjj/rollup-plugin-remove-others-console" rel="noopener noreferrer"&gt;rollup-plugin-remove-others-console&lt;/a&gt;：Remove console statements from other developers and keep only your own, making your development more refreshing!&lt;/p&gt;

&lt;p&gt;Welcome star and follow me!&lt;/p&gt;

&lt;h3&gt;
  
  
  install
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i rollup-plugin-remove-others-console -D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  use
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;vue&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@vitejs/plugin-vue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;removeOthersConsole&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rollup-plugin-remove-others-console&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;removeOthersConsole&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="c1"&gt;// . .. others&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  warn
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Not recommended for use in production environments
&lt;/h4&gt;

&lt;p&gt;If packaging only leaves the packager's console.log statement, it may affect other developers' debugging, although this is a bad habit!&lt;/p&gt;

&lt;p&gt;You can use the official Vite method to drop all console statements based on the following example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//vite.config.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;vue&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@vitejs/plugin-vue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;vue&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;minify&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;terser&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;terserOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;compress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//Remove console in production environment&lt;/span&gt;
        &lt;span class="na"&gt;drop_console&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;drop_debugger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Please ensure that the files being processed are the most original ones
&lt;/h4&gt;

&lt;p&gt;Due to the strict dependence of the plugin on line interpretation of Git authors, it is necessary to ensure that the plugin is executed before any plugins that may modify the source file.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>vite</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>v0</title>
      <dc:creator>ctjj</dc:creator>
      <pubDate>Thu, 21 Nov 2024 14:55:12 +0000</pubDate>
      <link>https://dev.to/ctjj_e0ca65f340e2d82720d4/v0-io</link>
      <guid>https://dev.to/ctjj_e0ca65f340e2d82720d4/v0-io</guid>
      <description></description>
    </item>
  </channel>
</rss>
