aboutsummaryrefslogtreecommitdiffstats
path: root/webpack.config.js
diff options
context:
space:
mode:
authorJose Dapena Paz <jdapena@igalia.com>2022-05-31 16:04:59 +0200
committerJose Dapena Paz <jdapena@igalia.com>2022-05-31 17:29:09 +0200
commit24e793a36f1e868761b44ecd43262f671772ff65 (patch)
treeb2c258e82cc59e34b146ac43956cb3bb355ce7ec /webpack.config.js
parent48a4f02ac1415ee0c57807784c215c72e94eefd4 (diff)
Update to recent dependencies
Update to recent webpack and other nodejs dependencies. Bug-AGL: SPEC-4248, SPEC-4355 Signed-off-by: Jose Dapena Paz <jdapena@igalia.com> Change-Id: I6a73194f9bbeb7ee99722192a9241888a3d24349
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js87
1 files changed, 34 insertions, 53 deletions
diff --git a/webpack.config.js b/webpack.config.js
index 68999df..4bb79af 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,30 +18,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/config.xml',
- 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',
@@ -51,13 +53,6 @@ module.exports = {
}),
new MiniCSSExtractPlugin({
filename: 'app.css',
- path: __dirname + '/dist'
- }),
- new ZipPlugin({
- path: __dirname + '/package',
- filename: 'mixer',
- extension: 'wgt',
- exclude: []
})
],
module: {
@@ -79,33 +74,19 @@ 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'
}
]
},
devServer: {
- contentBase: path.join(__dirname, 'dist'),
+ static: path.join(__dirname, 'dist'),
compress: true,
port: 9000
}