From 6963ed7ae57b60b9203652d307a8c37bbfacd111 Mon Sep 17 00:00:00 2001 From: KleoPetroff Date: Mon, 30 Jan 2017 23:44:53 +0200 Subject: [PATCH] fix eslint warnings and errors in webpack configs --- webpack.config.js | 38 ++++++++++++++--------------- webpack.production.config.js | 46 ++++++++++++++++++------------------ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 7a097609..27669c13 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,11 +1,11 @@ const { resolve } = require('path'); -var webpack = require('webpack'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); -var OpenBrowserPlugin = require('open-browser-webpack-plugin'); +const webpack = require('webpack'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const OpenBrowserPlugin = require('open-browser-webpack-plugin'); -var config = { +const config = { devtool: 'cheap-module-eval-source-map', entry: [ @@ -13,7 +13,7 @@ var config = { 'webpack-dev-server/client?http://localhost:8080', 'webpack/hot/only-dev-server', './main.js', - './assets/scss/main.scss' + './assets/scss/main.scss', ], output: { @@ -27,7 +27,7 @@ var config = { devServer: { hot: true, contentBase: resolve(__dirname, 'dist'), - publicPath: '/' + publicPath: '/', }, module: { @@ -37,37 +37,37 @@ var config = { loaders: [ 'babel-loader', ], - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /\.scss$/, exclude: /node_modules/, loader: ExtractTextPlugin.extract({ - fallbackLoader: "style-loader", + fallbackLoader: 'style-loader', loader: [ 'css-loader', { loader: 'sass-loader', query: { sourceMap: false, - } - } - ] - }) + }, + }, + ], + }), }, { test: /\.(png|jpg)$/, - loader: 'url?limit=15000' - } - ] + loader: 'url?limit=15000', + }, + ], }, plugins: [ - new ExtractTextPlugin({ filename: 'style.css', disable: false, allChunks: true}), + new ExtractTextPlugin({ filename: 'style.css', disable: false, allChunks: true }), new CopyWebpackPlugin([{ from: 'vendors', to: 'vendors' }]), new OpenBrowserPlugin({ url: 'http://localhost:8080' }), new webpack.HotModuleReplacementPlugin(), - ] + ], }; -module.exports = config; \ No newline at end of file +module.exports = config; diff --git a/webpack.production.config.js b/webpack.production.config.js index 6f25de8f..d1d512e4 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -1,15 +1,15 @@ -var { resolve } = require('path'); -var webpack = require('webpack'); -var HtmlWebpackPlugin = require('html-webpack-plugin'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); -var ExtractTextPlugin = require("extract-text-webpack-plugin"); +const { resolve } = require('path'); +const webpack = require('webpack'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); -var config = { +const config = { devtool: 'cheap-module-source-map', entry: [ './main.js', - './assets/scss/main.scss' + './assets/scss/main.scss', ], context: resolve(__dirname, 'app'), @@ -22,29 +22,29 @@ var config = { plugins: [ new HtmlWebpackPlugin({ - template: __dirname + '/app/index.html', + template: `${__dirname}/app/index.html`, filename: 'index.html', - inject: 'body' + inject: 'body', }), new webpack.optimize.OccurrenceOrderPlugin(), new webpack.LoaderOptionsPlugin({ minimize: true, - debug: false + debug: false, }), new webpack.optimize.UglifyJsPlugin({ beautify: false, mangle: { screw_ie8: true, - keep_fnames: true + keep_fnames: true, }, compress: { - screw_ie8: true + screw_ie8: true, }, - comments: false + comments: false, }), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } }), - new ExtractTextPlugin({ filename: 'style.css', disable: false, allChunks: true}), - new CopyWebpackPlugin([{ from: './vendors', to: 'vendors' }]) + new ExtractTextPlugin({ filename: 'style.css', disable: false, allChunks: true }), + new CopyWebpackPlugin([{ from: './vendors', to: 'vendors' }]), ], module: { @@ -52,25 +52,25 @@ var config = { { test: /\.js?$/, exclude: /node_modules/, - loader: 'babel-loader' + loader: 'babel-loader', }, { test: /\.scss$/, exclude: /node_modules/, loader: ExtractTextPlugin.extract({ - fallbackLoader: "style-loader", + fallbackLoader: 'style-loader', loader: [ 'css-loader', - { loader: 'sass-loader', query: { sourceMap: false } } - ] - }) + { loader: 'sass-loader', query: { sourceMap: false } }, + ], + }), }, { test: /\.(png|jpg)$/, - loader: 'url?limit=15000' + loader: 'url?limit=15000', }, - ] + ], }, }; -module.exports = config; \ No newline at end of file +module.exports = config;