summaryrefslogtreecommitdiffstats
path: root/webpack.config.js
diff options
context:
space:
mode:
authorJose Dapena Paz <jdapena@igalia.com>2022-05-23 12:58:05 +0200
committerJose Dapena Paz <jdapena@igalia.com>2022-05-23 13:27:12 +0200
commit15605b29a0978b02c5a6d046757b48d947fe4327 (patch)
tree1002c5b7d067d37d3ad2ed167e322d44d106d37c /webpack.config.js
parent58832e99bcd0580358d479222c2b5d42ee79bfcf (diff)
Update to recent dependencies
Update to recent webpack and other nodejs dependencies. Bug-AGL: SPEC-4248, SPEC-4355 Change-Id: Ia04f06072d9fee1684c1fa9a0483c10e935aab3f Signed-off-by: Jose Dapena Paz <jdapena@igalia.com>
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js94
1 files changed, 37 insertions, 57 deletions
diff --git a/webpack.config.js b/webpack.config.js
index 16a3f83..c2c8284 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',
@@ -20,35 +18,38 @@ 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/config.xml',
- flatten: true
- },
- {
- from: 'src/mockups/*',
- to: 'mockups/',
- flatten: true
- },
- {
- from: 'src/images/*',
- to: 'images/',
- flatten: true
- },
- {
- from: 'src/templates/*',
- to: 'templates/',
- 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]'
+ },
+ {
+ from: 'src/templates/*',
+ to: 'templates/[name][ext]'
+ }
+ ]
+ }),
new HtmlWebpackPlugin({
template: 'src/index.html',
filename: 'index.html',
@@ -56,13 +57,6 @@ module.exports = {
}),
new MiniCSSExtractPlugin({
filename: 'app.css',
- path: __dirname + '/dist'
- }),
- new ZipPlugin({
- path: __dirname + '/package',
- filename: 'dashboard',
- extension: 'wgt',
- exclude: []
})
],
module: {
@@ -92,28 +86,14 @@ module.exports = {
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
- use: [
- {
- loader: 'file-loader',
- options: {
- name: '[name].[ext]',
- outputPath: 'fonts/'
- }
- }
- ]
+ type: 'asset/resource',
+ generator: {
+ filename: 'fonts/[name][ext]'
+ }
},
{
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'
}
]
},