2017-03-06 1 views
2

내 규칙에 따라 내 eslint 규칙을 구성하고 프로젝트 파일을 리팩토링했습니다. 내가 잠시 그곳을 떠날 지 모른다고 경고하는 것이 있습니다. 하지만 문제는 브라우저 콘솔에 경고가 표시되어 개발이 불가능하다는 것입니다. 다음은 Webpack 브라우저 콘솔에서 eslint 경고 표시하지 않음

enter image description here

, 내 웹팩 설정 :

const path = require('path'); 
const webpack = require('webpack'); 
const ExtractTextPlugin = require("extract-text-webpack-plugin"); 
const context = path.resolve('.'); 


module.exports = { 
    context: context, 
    entry: './src/client.js', 
    output: { 
    path: path.join(context, 'build/client'), 
    publicPath: '/static/', 
    filename: '[name]-[hash].js' 
    }, 
    module: { 
    preLoaders: [ 
     { 
     test: /\.js$/, 
     exclude: /node_modules/, 
     loader: 'eslint-loader' 
     }, 
    ], 
    loaders: [{ 
     test: /(?:node_modules).+\.css$/, 
     loader: 'style!css' 
    }, { 
     test: /\.scss$/, 
     loader: ExtractTextPlugin.extract([ 
     'css-loader', 
     'postcss-loader', 
     'sass-loader', 
     'sass-resources' 
     ]) 
    }, { 
     test: /\.js$/, 
     loader: 'babel', 
     exclude: /(node_modules)/ 
    }, { 
    test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, 
    loader: "url?limit=10000&mimetype=application/font-woff" 
    }, { 
    test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, 
    loader: "url?limit=10000&mimetype=application/font-woff" 
    }, { 
    test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, 
    loader: "url?limit=10000&mimetype=application/octet-stream" 
    }, { 
    test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, 
    loader: "file" 
    }, { 
    test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, 
    loader: "url?limit=10000&mimetype=image/svg+xml" 
    }, { 
     test: /\.json$/, 
     loader: 'json' 
    }] 
    }, 
    postcss: function() { 
    return [ 
     require('autoprefixer') 
    ]; 
    }, 
    sassResources: [ 
    path.resolve(__dirname, '../src/stylesheets/base/_variables.scss'), 
    path.resolve(__dirname, '../src/stylesheets/base/_mixins.scss') 
    ], 
    devServer: { 
    watchOptions: { 
     aggregateTimeout: 1000 
    } 
    }, 
    plugins: [ 
    new ExtractTextPlugin("[name]-[hash].css"), 
    new webpack.DefinePlugin({ 
     'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'local') 
    }) 
    ], 
    devtool: "cheap-module-source-map" 
}; 

난 단지 브라우저 콘솔이 아닌에 대한 경고를 억제 할 수있는 방법을 errors에 문제가 브라우저 콘솔에 표시되고 있지,하지만이 노드 터미널?

module: { 
    rules: [ 
    { 
     test: /\.js$/, 
     exclude: /(node_modules)/, 
     use: [ 
     { 
      loader: 'babel-loader', 
      options: { 
      presets: [ 
       ['es2015', {modules: false}], 
       'react' 
      ], 
      plugins: [ 'react-hot-loader/babel' ] 
      } 
     }, { 
      loader: 'eslint-loader', 
      options: { 
      quiet: true 
      } 
     } 
     ] 
    } 
    ] 
} 

의 마지막 행은이 경고를 억제하는 방법이다, quiet: true입니다 : 내 webpack.config.js에서

답변

2

https://devhub.io/repos/coryhouse-eslint-loader

내가 옵션 설정이 있습니다.

+1

이것은 브라우저 콘솔뿐만 아니라 노드 터미널에서도 경고를 숨 깁니다. – Mel

+1

예, 터미널에는 로그가 있지만 브라우저에는 로그가없는 방법을 찾고 있습니다. –

관련 문제