title: VueJS 2: How To Remove Console.log from Production Builds?
body: <p>In IE, console is only defined when in F12 debugging mode.
  So I'm looking for a convenient way to manage the compilation of Vue</p>
  
  <p>I'd like to be able to write console.log inside the code</p>
  
  <pre class="lang-js prettyprint-override"><code>alert('a');
  console.log('only in development mode');
  alert('b');
  </code></pre>
  
  <p>If i compile in production mode,
  the command console must disappear</p>
  
  <pre class="lang-js prettyprint-override"><code>alert('a');
  alert('b');
  </code></pre>
  
  <p>If i work in develope mode,
  the command console must appear</p>
  
  <pre class="lang-js prettyprint-override"><code>alert('a');
  console.log('only in development mode');
  alert('b');
  </code></pre>
  
  <p>In VueJS, I have two webpack configurations: one for development and one for production - could this be the way?</p>
  
  <p>I can not configure the webpack file correctly,
  but I think it's something like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
  module.exports.plugins = (module.exports.plugins || []).concat([
   new UglifyJsPlugin({
    sourceMap: true,
    compress: {
      drop_console: true,
      warnings: false
    },
    comments: false
   }),
  ])
  </code></pre>