webpack: remove eslint, added terser optimization in prod build

This commit is contained in:
Bachir Soussi Chiadmi 2020-11-25 15:25:57 +01:00
parent c12f72e3fe
commit f002c81008
7 changed files with 3624 additions and 2326 deletions

View File

@ -1,8 +0,0 @@
core/**/*
vendor/**/*
sites/**/files/**/*
libraries/**/*
sites/**/libraries/**/*
profiles/**/libraries/**/*
**/js_test_files/**/*
**/node_modules/**/*

View File

@ -1,29 +0,0 @@
module.exports =
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
node: true,
mocha: true
},
globals: {
"expect": true,
"jQuery": false
},
extends: [
'./web/core/.eslintrc.json',
'plugin:vue/recommended',
'plugin:vue-a11y/base',
'standard'
],
plugins: [
'vue',
'vue-a11y'
],
rules: {
'generator-star-spacing': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}

View File

@ -1,7 +1,7 @@
'use strict' 'use strict'
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { VueLoaderPlugin } = require('vue-loader') const { VueLoaderPlugin } = require('vue-loader')
const ESLintPlugin = require('eslint-webpack-plugin');
const utils = require('./utils') const utils = require('./utils')
@ -25,16 +25,16 @@ module.exports = {
}, },
module: { module: {
rules: [ rules: [
{ // {
test: /\.(js|vue)$/, // test: /\.(js|vue)$/,
loader: 'eslint-loader', // loader: 'eslint-loader',
enforce: 'pre', // enforce: 'pre',
exclude: /node_modules/, // exclude: /node_modules/,
options: { // options: {
emitError: true, // emitError: true,
emitWarning: true // emitWarning: true
} // }
}, // },
{ {
test: /\.vue$/, test: /\.vue$/,
use: 'vue-loader' use: 'vue-loader'
@ -82,5 +82,6 @@ module.exports = {
filename: '[name].css' filename: '[name].css'
}), }),
new VueLoaderPlugin() new VueLoaderPlugin()
// new ESLintPlugin()
] ]
} }

View File

@ -7,7 +7,6 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = merge(baseConfig, { module.exports = merge(baseConfig, {
mode: 'development', mode: 'development',
module: { module: {
rules: [ rules: [
{ {

View File

@ -4,35 +4,10 @@ const webpack = require('webpack')
const merge = require('webpack-merge') const merge = require('webpack-merge')
const baseConfig = require('./webpack.config.base') const baseConfig = require('./webpack.config.base')
const MiniCssExtractPlugin = require('mini-css-extract-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const TerserPlugin = require("terser-webpack-plugin");
module.exports = merge(baseConfig, { module.exports = merge(baseConfig, {
mode: 'production', mode: 'production',
optimization: {
minimizer: [
new UglifyJSPlugin({
uglifyOptions: {
// Eliminate comments
comments: false,
// remove warnings
warnings: false,
compress: {
// Drop console statements
drop_console: true,
}
}
})
]
// splitChunks: {
// cacheGroups: {
// commons: {
// test: /[\\/]node_modules[\\/]/,
// name: "vendor",
// chunks: "all",
// },
// },
// },
},
module: { module: {
rules: [ rules: [
{ {
@ -61,9 +36,22 @@ module.exports = merge(baseConfig, {
} }
] ]
}, },
plugins: [ optimization: {
// new MiniCssExtractPlugin({ minimize: true,
// filename: 'main.css' minimizer: [
// }) new TerserPlugin({
] sourceMap: true, // Must be set to true if using source-maps in production
parallel: true,
test: /\.(js|vue)$/,
// extractComments: true
terserOptions: {
compress: {
drop_console: true,
},
},
})
],
},
// ,
// plugins: []
}) })

5795
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,53 +19,51 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^0.18.1", "axios": "^0.18.1",
"vue": "^2.6.10", "vue": "^2.6.12",
"vue-autofocus-directive": "^1.0.4", "vue-autofocus-directive": "^1.0.4",
"vue-cool-lightbox": "^1.0.11", "vue-cool-lightbox": "^1.1.0",
"vue-infinite-loading": "^2.4.4", "vue-infinite-loading": "^2.4.5",
"vue-meta": "^1.6.0", "vue-meta": "^1.6.0",
"vue-router": "^3.1.3", "vue-router": "^3.4.9",
"vue-vimeo-player": "^0.1.0", "vue-vimeo-player": "^0.1.0",
"vue-youtube-embed": "^2.2.2", "vue-youtube-embed": "^2.2.2",
"vuex": "^3.1.1" "vuex": "^3.5.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.7.0", "@babel/core": "^7.12.9",
"@babel/preset-env": "^7.7.1", "@babel/preset-env": "^7.12.7",
"@vue/test-utils": "^1.0.0-beta.29", "@vue/test-utils": "^1.1.1",
"babel-core": "^7.0.0-bridge.0", "babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.3", "babel-eslint": "^10.1.0",
"babel-jest": "^24.9.0", "babel-jest": "^24.9.0",
"babel-loader": "^8.0.6", "babel-loader": "^8.2.1",
"copy-webpack-plugin": "^5.0.4", "copy-webpack-plugin": "^5.1.2",
"css-loader": "^2.1.1", "css-loader": "^2.1.1",
"eslint": "^5.15.3", "eslint": "^5.15.3",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.15.0", "eslint-config-prettier": "^6.15.0",
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-loader": "^2.2.1", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^8.0.1", "eslint-plugin-node": "^8.0.1",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5", "eslint-plugin-standard": "^4.1.0",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^5.2.3", "eslint-plugin-vue": "^5.2.3",
"eslint-plugin-vue-a11y": "0.0.28", "eslint-plugin-vue-a11y": "0.0.28",
"eslint-webpack-plugin": "^2.4.0",
"mini-css-extract-plugin": "^0.5.0", "mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.13.0", "node-sass": "^4.14.1",
"sass-loader": "^7.3.1", "sass-loader": "^7.3.1",
"style-loader": "^0.23.1", "style-loader": "^0.23.1",
"uglify-es": "^3.3.9", "uglify-es": "^3.3.9",
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^1.1.2", "url-loader": "^1.1.2",
"vue-jest": "^3.0.5", "vue-jest": "^3.0.7",
"vue-loader": "^15.7.2", "vue-loader": "^15.9.5",
"vue-server-renderer": "^2.6.10", "vue-server-renderer": "^2.6.12",
"vue-style-loader": "^4.1.2", "vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.10", "vue-template-compiler": "^2.6.12",
"webpack": "^4.41.2", "webpack": "^4.44.2",
"webpack-cli": "^3.3.10", "webpack-cli": "^3.3.12",
"webpack-merge": "^4.2.2" "webpack-merge": "^4.2.2"
} }
} }