From b72cf10ccf2164820ff05f10f7991e4f4fc2527e Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Fri, 9 Dec 2022 10:33:03 +0300 Subject: [PATCH 001/116] Web: Client: Changed deploy statics (added loaders) --- packages/client/package.json | 1 + packages/client/public/index.html | 4 +- packages/client/webpack.config.js | 79 ++++++++++++++++++++----------- yarn.lock | 52 ++++++++++++++++++-- 4 files changed, 103 insertions(+), 33 deletions(-) diff --git a/packages/client/package.json b/packages/client/package.json index a7c98f95f6..65984ba828 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -67,6 +67,7 @@ "css-loader": "^6.2.0", "external-remotes-plugin": "^1.0.0", "file-loader": "^6.2.0", + "html-loader": "^4.2.0", "html-webpack-plugin": "5.3.2", "json-loader": "^0.5.7", "playwright": "^1.18.1", diff --git a/packages/client/public/index.html b/packages/client/public/index.html index 10f57a0d50..8e1238046c 100644 --- a/packages/client/public/index.html +++ b/packages/client/public/index.html @@ -36,8 +36,8 @@ content="app-id=com.onlyoffice.documents" /> - - + + <%= htmlWebpackPlugin.options.custom %> diff --git a/packages/client/webpack.config.js b/packages/client/webpack.config.js index 363c1dc080..7960f54f52 100644 --- a/packages/client/webpack.config.js +++ b/packages/client/webpack.config.js @@ -95,7 +95,30 @@ const config = { module: { rules: [ { - test: /\.(png|jpe?g|gif|ico)$/i, + test: /\.html$/i, + loader: "html-loader", + options: { + sources: { + urlFilter: (attribute, value, resourcePath) => { + // The `attribute` argument contains a name of the HTML attribute. + // The `value` argument contains a value of the HTML attribute. + // The `resourcePath` argument contains a path to the loaded HTML file. + + if ( + /manifest\.json$/.test(value) || + /favicon\.ico$/.test(value) || + /appIcon-180\.png$/.test(value) + ) { + return false; + } + + return true; + }, + }, + }, + }, + { + test: /\.(png|jpe?g|gif|ico|svg)$/i, type: "asset/resource", generator: { filename: "static/images/[hash][ext][query]", @@ -108,19 +131,19 @@ const config = { fullySpecified: false, }, }, - { - test: /\.react.svg$/, - use: [ - { - loader: "@svgr/webpack", - options: { - svgoConfig: { - plugins: [{ removeViewBox: false }], - }, - }, - }, - ], - }, + // { + // test: /\.react.svg$/, + // use: [ + // { + // loader: "@svgr/webpack", + // options: { + // svgoConfig: { + // plugins: [{ removeViewBox: false }], + // }, + // }, + // }, + // ], + // }, { test: /\.json$/, loader: "json-loader" }, { test: /\.css$/i, @@ -182,19 +205,19 @@ const config = { new CleanWebpackPlugin(), new ExternalTemplateRemotesPlugin(), - new CopyPlugin({ - patterns: [ - { - context: path.resolve(__dirname, "public"), - from: "images/**/*.*", - }, - { - context: path.resolve(__dirname, "public"), - from: "locales/**/*.json", - transform: minifyJson, - }, - ], - }), + // new CopyPlugin({ + // patterns: [ + // { + // context: path.resolve(__dirname, "public"), + // from: "images/**/*.*", + // }, + // { + // context: path.resolve(__dirname, "public"), + // from: "locales/**/*.json", + // transform: minifyJson, + // }, + // ], + // }), ], }; @@ -271,9 +294,9 @@ module.exports = (env, argv) => { if (!!env.hideText) { config.plugins.push( new HtmlWebpackPlugin({ + title: title, template: "./public/index.html", publicPath: homepage, - title: title, base: `${homepage}/`, custom: `