File tree Expand file tree Collapse file tree 4 files changed +152
-105
lines changed Expand file tree Collapse file tree 4 files changed +152
-105
lines changed Original file line number Diff line number Diff line change 8686 "@babel/preset-typescript" : " ^7.12.7" ,
8787 "@babel/register" : " ^7.12.10" ,
8888 "@babel/runtime" : " ^7.12.5" ,
89+ "@principalstudio/html-webpack-inject-preload" : " ^1.2.7" ,
8990 "@types/flux" : " ^3.1.9" ,
9091 "@types/modernizr" : " ^3.5.3" ,
9192 "@types/node" : " ^14.14.22" ,
111112 "fake-indexeddb" : " ^3.1.2" ,
112113 "file-loader" : " ^5.1.0" ,
113114 "fs-extra" : " ^0.30.0" ,
114- "html-webpack-plugin" : " ^3.2.0 " ,
115+ "html-webpack-plugin" : " ^4.5.2 " ,
115116 "jest" : " ^26.6.3" ,
116117 "jest-environment-jsdom-sixteen" : " ^1.0.3" ,
117118 "json-loader" : " ^0.5.7" ,
Original file line number Diff line number Diff line change 2222 < meta name ="msapplication-TileImage " content ="<%= require('../../res/vector-icons/mstile-150.png') %> ">
2323 < meta name ="msapplication-config " content ="<%= require('../../res/vector-icons/browserconfig.xml') %> ">
2424 < meta name ="theme-color " content ="#ffffff ">
25- < meta property ="og:image " content ="<%= htmlWebpackPlugin.options.vars. og_image_url %> " />
25+ < meta property ="og:image " content ="<%= og_image_url %> " />
2626 < meta http-equiv ="Content-Security-Policy " content ="
2727 default-src 'none';
2828 style-src 'self' 'unsafe-inline';
4949 < link rel ="stylesheet " href ="<%= file %> ">
5050 < % }
5151 } %>
52+
53+ < % for (var i=0; i < htmlWebpackPlugin .tags.headTags.length; i++) {
54+ var tag = htmlWebpackPlugin.tags.headTags[i];
55+ var path = tag.attributes && tag.attributes.href;
56+ if (path.indexOf( "Inter") !== -1) { % >
57+ < link rel ="preload " as ="font " href ="<%= path %> " crossorigin ="anonymous "/>
58+ < % }
59+ } %>
60+
5261 </ head >
53- < body style ="height: 100%; margin: 0; " data-vector-indexeddb-worker-script ="<%= htmlWebpackPlugin.files.chunks[' indexeddb-worker'].entry %> ">
62+ < body style ="height: 100%; margin: 0; " data-vector-indexeddb-worker-script ="<%= htmlWebpackPlugin.files.js.find(entry => entry.includes( " indexeddb-worker.js ")) %> ">
5463 < noscript > Sorry, Element requires JavaScript to be enabled.</ noscript > <!-- TODO: Translate this? -->
5564 < section id ="matrixchat " style ="height: 100%; overflow: auto; " class ="notranslate "> </ section >
56- < script src ="<%= htmlWebpackPlugin.files.chunks['bundle']. entry %> "> </ script >
65+ < script src ="<%= htmlWebpackPlugin.files.js.find( entry => entry.includes( " bundle.js ")) %> "></ script >
5766
5867 <!-- Legacy supporting Prefetch images -->
5968 < img src ="<%= require('matrix-react-sdk/res/img/warning.svg') %> " width ="24 " height ="23 " style ="visibility: hidden; position: absolute; top: 0px; left: 0px; "/>
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
44const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
55const OptimizeCSSAssetsPlugin = require ( 'optimize-css-assets-webpack-plugin' ) ;
66const webpack = require ( "webpack" ) ;
7+ const HtmlWebpackInjectPreload = require ( '@principalstudio/html-webpack-inject-preload' ) ;
78
89let ogImageUrl = process . env . RIOT_OG_IMAGE_URL ;
910if ( ! ogImageUrl ) ogImageUrl = 'https://app.element.io/themes/element/img/logos/opengraph.png' ;
@@ -343,7 +344,7 @@ module.exports = (env, argv) => {
343344 inject : false ,
344345 excludeChunks : [ 'mobileguide' , 'usercontent' , 'jitsi' ] ,
345346 minify : argv . mode === 'production' ,
346- vars : {
347+ templateParameters : {
347348 og_image_url : ogImageUrl ,
348349 } ,
349350 } ) ,
@@ -386,6 +387,10 @@ module.exports = (env, argv) => {
386387 chunks : [ 'usercontent' ] ,
387388 } ) ,
388389
390+ new HtmlWebpackInjectPreload ( {
391+ files : [ { match : / .* I n t e r .* \. w o f f 2 ? $ / } ] ,
392+ } ) ,
393+
389394 ...additionalPlugins ,
390395 ] ,
391396
You can’t perform that action at this time.
0 commit comments