title: How to include node module for Babel using Webpack
body: <p>when running </p>
  
  <pre><code>npm run build
  </code></pre>
  
  <p>I encounter an es6 related syntax error from uglify, so I'm guessing babel isn't handling the node module (sec-to-min) properly.</p>
  
  <p>My .babelrc</p>
  
  <pre><code>{
    "presets": ["es2015", "stage-0"],
    "plugins": ["transform-runtime"],
    "comments": false,
    "env": {
      "test": {
        "plugins": [ "istanbul" ]
      }
    }
  }
  </code></pre>
  
  <p>My Webpack config: </p>
  
  <pre><code>var path = require('path')
  var config = require('../config')
  var utils = require('./utils')
  var projectRoot = path.resolve(__dirname, '../')
  
  var env = process.env.NODE_ENV
  // check env &amp; config/index.js to decide whether to enable CSS source maps for the
  // various preprocessor loaders added to vue-loader at the end of this file
  var cssSourceMapDev = (env === 'development' &amp;&amp; config.dev.cssSourceMap)
  var cssSourceMapProd = (env === 'production' &amp;&amp; config.build.productionSourceMap)
  var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
  
  module.exports = {
    entry: {
      app: './src/main.js'
    },
    output: {
      path: config.build.assetsRoot,
      publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
      filename: '[name].js'
    },
    resolve: {
      extensions: ['', '.js', '.vue', '.json'],
      fallback: [path.join(__dirname, '../node_modules')],
      alias: {
        'vue$': 'vue/dist/vue.common.js',
        'src': path.resolve(__dirname, '../src'),
        'assets': path.resolve(__dirname, '../src/assets'),
        'components': path.resolve(__dirname, '../src/components')
      }
    },
    resolveLoader: {
      fallback: [path.join(__dirname, '../node_modules')]
    },
    module: {
      preLoaders: [
        {
          test: /\.vue$/,
          loader: 'eslint',
          include: [
            path.join(projectRoot, 'src')
          ],
          exclude: /node_modules/
        },
        {
          test: /\.js$/,
          loader: 'eslint',
          include: [
            path.join(projectRoot, 'src')
          ],
          exclude: /node_modules/
        }
      ],
      loaders: [
        {
          test: /\.vue$/,
          loader: 'vue'
        },
        {
          test: /\.js$/,
          loader: 'babel',
          include: [
            path.join(projectRoot, 'src'),
            'node_modules/sec-to-min'
          ],
          exclude: /node_modules/
        },
        {
          test: /\.json$/,
          loader: 'json'
        },
        {
          test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
          loader: 'url',
          query: {
            limit: 10000,
            name: utils.assetsPath('img/[name].[hash:7].[ext]')
          }
        },
        {
          test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
          loader: 'url',
          query: {
            limit: 10000,
            name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
          }
        }
      ]
    },
    eslint: {
      formatter: require('eslint-friendly-formatter')
    },
    vue: {
      loaders: utils.cssLoaders({ sourceMap: useCssSourceMap }),
      postcss: [
        require('autoprefixer')({
          browsers: ['last 2 versions']
        })
      ]
    }
  }
  </code></pre>
  
  <p>&amp; the ERR:</p>
  
  <blockquote>
    <p>ERROR in static/js/vendor.8d64852626f0513309d9.js from UglifyJs
    SyntaxError: Unexpected token: operator (>)
    [./~/sec-to-min/index.js:3,0]</p>
  </blockquote>
  
  <p>How can I direct babel to compile this module?</p>