Skip to content

Commit

Permalink
Merge pull request #17963 from vector-im/t3chguy/ts/c3
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Jul 14, 2021
2 parents 5646f3a + 7aca548 commit 6c476bd
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 97 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@
"shell-escape": "^0.2.0",
"simple-proxy-agent": "^1.1.0",
"stylelint": "^13.9.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0",
"terser-webpack-plugin": "^2.3.8",
"typescript": "^4.1.3",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2"
"webpack-dev-server": "^3.11.2",
"worker-loader": "^2.0.0"
},
"jest": {
"testEnvironment": "jest-environment-jsdom-sixteen",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"Missing indexeddb worker script!": "Missing indexeddb worker script!",
"Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.",
"Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.",
"Your Element is misconfigured": "Your Element is misconfigured",
Expand Down
13 changes: 0 additions & 13 deletions src/vector/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import AutoDiscoveryUtils from 'matrix-react-sdk/src/utils/AutoDiscoveryUtils';
import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery";
import * as Lifecycle from "matrix-react-sdk/src/Lifecycle";
import type MatrixChatType from "matrix-react-sdk/src/components/structures/MatrixChat";
import { MatrixClientPeg } from 'matrix-react-sdk/src/MatrixClientPeg';
import SdkConfig from "matrix-react-sdk/src/SdkConfig";

import { parseQs, parseQsFromFragment } from './url_utils';
Expand Down Expand Up @@ -129,18 +128,6 @@ function onTokenLoginCompleted() {
}

export async function loadApp(fragParams: {}) {
// XXX: the way we pass the path to the worker script from webpack via html in body's dataset is a hack
// but alternatives seem to require changing the interface to passing Workers to js-sdk
const vectorIndexeddbWorkerScript = document.body.dataset.vectorIndexeddbWorkerScript;
if (!vectorIndexeddbWorkerScript) {
// If this is missing, something has probably gone wrong with
// the bundling. The js-sdk will just fall back to accessing
// indexeddb directly with no worker script, but we want to
// make sure the indexeddb script is present, so fail hard.
throw newTranslatableError(_td("Missing indexeddb worker script!"));
}
MatrixClientPeg.setIndexedDbWorkerScript(vectorIndexeddbWorkerScript);

window.addEventListener('hashchange', onHashChange);

const platform = PlatformPeg.get();
Expand Down
1 change: 0 additions & 1 deletion src/vector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
</head>
<body
style="height: 100%; margin: 0;"
data-vector-indexeddb-worker-script="<%= htmlWebpackPlugin.files.js.find(entry => entry.includes("indexeddb-worker.js")) %>"
data-vector-recorder-worklet-script="<%= htmlWebpackPlugin.files.js.find(entry => entry.includes("recorder-worklet.js")) %>"
>
<noscript>Sorry, Element requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
Expand Down
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ module.exports = (env, argv) => {

entry: {
"bundle": "./src/vector/index.ts",
"indexeddb-worker": "./src/vector/indexeddb-worker.ts",
"mobileguide": "./src/vector/mobile_guide/index.ts",
"jitsi": "./src/vector/jitsi/index.ts",
"usercontent": "./node_modules/matrix-react-sdk/src/usercontent/index.js",
Expand Down Expand Up @@ -151,6 +150,10 @@ module.exports = (env, argv) => {
/olm[\\/](javascript[\\/])?olm\.js$/,
],
rules: [
{
test: /\.worker\.ts$/,
loader: "worker-loader",
},
{
test: /\.(ts|js)x?$/,
include: (f) => {
Expand Down
Loading

0 comments on commit 6c476bd

Please sign in to comment.