From 6abbe876aee09b225af9329e28b4fa2cc4d4c220 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Tue, 3 May 2022 18:02:45 +0200 Subject: Update to recent dependencies. Update to recent versions of webpack and other nodejs dependencies. Bug-AGL: SPEC-4355 Signed-off-by: Jose Dapena Paz Change-Id: I1740be13a4b0b3e6b5832e58a805f1fa8374236b --- package.json | 27 +++++++++----------- webpack.config.js | 74 ++++++++++++++++++++++--------------------------------- 2 files changed, 42 insertions(+), 59 deletions(-) diff --git a/package.json b/package.json index 06ec58e..ba76bd5 100644 --- a/package.json +++ b/package.json @@ -18,21 +18,18 @@ "automotivegradelinux" ], "devDependencies": { - "clean-webpack-plugin": "^1.0.1", - "copy-webpack-plugin": "^4.6.0", - "css-loader": "^2.1.0", - "file-loader": "^4.0.0", - "html-webpack-plugin": "^3.2.0", - "image-webpack-loader": "^5.0.0", - "mini-css-extract-plugin": "^0.5.0", - "node-sass": "^4.12.0", - "sass-loader": "^7.1.0", - "style-loader": "^0.23.1", - "uglifyjs-webpack-plugin": "^2.1.1", - "webpack": "^4.29.5", - "webpack-cli": "^3.2.3", - "webpack-dev-server": "^3.7.2", - "zip-webpack-plugin": "^3.0.0" + "clean-webpack-plugin": "^4.0.0", + "copy-webpack-plugin": "^10.2.4", + "css-loader": "^6.7.1", + "html-webpack-plugin": "^5.5.0", + "mini-css-extract-plugin": "^2.6.0", + "node-sass": "^7.0.1", + "sass-loader": "^12.6.0", + "style-loader": "^3.3.1", + "uglify-js": "^3.15.4", + "webpack": "^5.72.0", + "webpack-cli": "^4.9.2", + "webpack-dev-server": "^4.8.1" }, "dependencies": {} } diff --git a/webpack.config.js b/webpack.config.js index b300f01..9c87768 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,11 +1,9 @@ const path = require('path'); -const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCSSExtractPlugin = require('mini-css-extract-plugin'); const CopyPlugin = require('copy-webpack-plugin'); -const ZipPlugin = require('zip-webpack-plugin'); - module.exports = { mode: 'production', @@ -24,30 +22,34 @@ module.exports = { library: '[name]' }, optimization: { - minimizer: [new UglifyJsPlugin()], + minimize: true, + minimizer: [ + new TerserPlugin({ + minify: TerserPlugin.uglifyJsMinify, + terserOptions: {} + }) + ], }, plugins: [ - new CleanWebpackPlugin(['dist']), - new CopyPlugin([ - { - from: 'src/icon.*', - flatten: true - }, - { - from: 'src/appinfo.json', - flatten: true - }, - { - from: 'src/mockups/*', - to: 'mockups/', - flatten: true - }, - { - from: 'src/images/*', - to: 'images/', - flatten: true - } - ]), + new CleanWebpackPlugin({ + cleanAfterEveryBuildPatterns: ['dist'] + }), + new CopyPlugin({ + patterns: [ + { + from: 'src/icon.*', + to: '[name][ext]' + }, + { + from: 'src/appinfo.json', + to: 'appinfo.json' + }, + { + from: 'src/images/*', + to: 'images/[name][ext]' + } + ] + }), new HtmlWebpackPlugin({ template: 'src/index.html', filename: 'index.html', @@ -55,13 +57,6 @@ module.exports = { }), new MiniCSSExtractPlugin({ filename: 'app.css', - path: __dirname + '/dist' - }), - new ZipPlugin({ - path: __dirname + '/package', - filename: 'hvac', - extension: 'wgt', - exclude: [] }) ], module: { @@ -83,16 +78,7 @@ module.exports = { }, { test: /\.(gif|png|jpe?g|svg)$/i, - use: [ - 'file-loader', - { - loader: "image-webpack-loader", - options: { - bypassOnDebug: true, // webpack@1.x - disable: true, // webpack@2.x and newer - }, - } - ] + type: 'asset/resource', } ] }, @@ -101,4 +87,4 @@ module.exports = { compress: true, port: 9000 } -};  \ No newline at end of file +};  -- cgit 1.2.3-korg