mirror of
https://github.com/vector-im/element-web.git
synced 2024-09-09 22:55:12 +00:00
Attempt to fix tests some more
This commit is contained in:
parent
f14bd05cfb
commit
c76a5f2c52
7 changed files with 1220 additions and 24 deletions
|
@ -142,7 +142,8 @@
|
||||||
"typescript": "^3.7.3",
|
"typescript": "^3.7.3",
|
||||||
"webpack": "^4.41.2",
|
"webpack": "^4.41.2",
|
||||||
"webpack-cli": "^3.3.10",
|
"webpack-cli": "^3.3.10",
|
||||||
"webpack-dev-server": "^3.9.0"
|
"webpack-dev-server": "^3.9.0",
|
||||||
|
"workbox-webpack-plugin": "^5.1.4"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"testEnvironment": "jest-environment-jsdom-fourteen",
|
"testEnvironment": "jest-environment-jsdom-fourteen",
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
self.addEventListener('fetch',() => {});
|
|
|
@ -61,7 +61,6 @@ const INCLUDE_LANGS = [
|
||||||
// "dest/b/...".
|
// "dest/b/...".
|
||||||
const COPY_LIST = [
|
const COPY_LIST = [
|
||||||
["res/manifest.json", "webapp"],
|
["res/manifest.json", "webapp"],
|
||||||
["res/sw.js", "webapp"],
|
|
||||||
["res/welcome.html", "webapp"],
|
["res/welcome.html", "webapp"],
|
||||||
["res/welcome/**", "webapp/welcome"],
|
["res/welcome/**", "webapp/welcome"],
|
||||||
["res/themes/**", "webapp/themes"],
|
["res/themes/**", "webapp/themes"],
|
||||||
|
|
|
@ -55,16 +55,6 @@
|
||||||
<section id="matrixchat" style="height: 100%; overflow: auto;" class="notranslate"></section>
|
<section id="matrixchat" style="height: 100%; overflow: auto;" class="notranslate"></section>
|
||||||
<script src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script>
|
<script src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script>
|
||||||
|
|
||||||
<!-- Legacy supporting Prefetch images -->
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/warning.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/e2e/warning.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/feather-customised/warning-triangle.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/format/bold.svg') %>" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/format/code.svg') %>" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/format/italics.svg') %>" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/format/quote.svg') %>" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
<img src="<%= require('matrix-react-sdk/res/img/format/strikethrough.svg') %>" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
|
||||||
|
|
||||||
<audio id="messageAudio">
|
<audio id="messageAudio">
|
||||||
<source src="media/message.ogg" type="audio/ogg" />
|
<source src="media/message.ogg" type="audio/ogg" />
|
||||||
<source src="media/message.mp3" type="audio/mpeg" />
|
<source src="media/message.mp3" type="audio/mpeg" />
|
||||||
|
|
|
@ -30,7 +30,7 @@ import './modernizr';
|
||||||
|
|
||||||
// load service worker if available on this platform
|
// load service worker if available on this platform
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.register('sw.js');
|
navigator.serviceWorker.register('service-worker.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function settled(...promises: Array<Promise<any>>) {
|
async function settled(...promises: Array<Promise<any>>) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||||
const webpack = require("webpack");
|
const WorkboxPlugin = require('workbox-webpack-plugin');
|
||||||
|
|
||||||
let og_image_url = process.env.RIOT_OG_IMAGE_URL;
|
let og_image_url = process.env.RIOT_OG_IMAGE_URL;
|
||||||
if (!og_image_url) og_image_url = 'https://app.element.io/themes/element/img/logos/opengraph.png';
|
if (!og_image_url) og_image_url = 'https://app.element.io/themes/element/img/logos/opengraph.png';
|
||||||
|
@ -248,9 +248,9 @@ module.exports = (env, argv) => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// cache-bust languages.json file placed in
|
// cache-bust i18n .json files placed in
|
||||||
// riot-web/webapp/i18n during build by copy-res.js
|
// riot-web/webapp/i18n during build by copy-res.js
|
||||||
test: /\.*languages.json$/,
|
test: /i18n\/.*\.json$/,
|
||||||
type: "javascript/auto",
|
type: "javascript/auto",
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
|
@ -356,6 +356,20 @@ module.exports = (env, argv) => {
|
||||||
minify: argv.mode === 'production',
|
minify: argv.mode === 'production',
|
||||||
chunks: ['usercontent'],
|
chunks: ['usercontent'],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
new WorkboxPlugin.GenerateSW({
|
||||||
|
runtimeCaching: [{
|
||||||
|
urlPattern: /i18n\/.*\.json$/,
|
||||||
|
handler: 'CacheFirst',
|
||||||
|
|
||||||
|
options: {
|
||||||
|
cacheName: 'i18n',
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
|
|
Loading…
Reference in a new issue