Page MenuHomePhabricator

D7092.id23835.diff
No OneTemporary

D7092.id23835.diff

diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -69,6 +69,7 @@
+fontsURL: string,
+cssInclude: string,
+olmFilename: string,
+ +sqljsFilename: string,
};
let assetInfo: ?AssetInfo = null;
async function getAssetInfo() {
@@ -82,12 +83,18 @@
fontsURL,
cssInclude: '',
olmFilename: '',
+ sqljsFilename: '',
};
return assetInfo;
}
try {
const manifestString = await readFile('../web/dist/manifest.json', 'utf8');
const manifest = JSON.parse(manifestString);
+ const webworkersManifestString = await readFile(
+ '../web/dist/webworkers/manifest.json',
+ 'utf8',
+ );
+ const webworkersManifest = JSON.parse(webworkersManifestString);
assetInfo = {
jsURL: `compiled/${manifest['browser.js']}`,
fontsURL: googleFontsURL,
@@ -99,6 +106,7 @@
/>
`,
olmFilename: manifest['olm.wasm'],
+ sqljsFilename: webworkersManifest['sql-wasm.wasm'],
};
return assetInfo;
} catch {
@@ -324,7 +332,8 @@
return pushConfig.publicKey;
})();
- const { jsURL, fontsURL, cssInclude, olmFilename } = await assetInfoPromise;
+ const { jsURL, fontsURL, cssInclude, olmFilename, sqljsFilename } =
+ await assetInfoPromise;
// prettier-ignore
res.write(html`
@@ -423,6 +432,7 @@
;
var baseURL = "${baseURL}";
var olmFilename = "${olmFilename}";
+ var sqljsFilename = "${sqljsFilename}";
</script>
<script src="${jsURL}"></script>
</body>
diff --git a/web/webpack.config.cjs b/web/webpack.config.cjs
--- a/web/webpack.config.cjs
+++ b/web/webpack.config.cjs
@@ -91,16 +91,6 @@
};
const baseWebWorkersConfig = {
- plugins: [
- new CopyPlugin({
- patterns: [
- {
- from: 'node_modules/sql.js/dist/sql-wasm.wasm',
- to: path.join(__dirname, 'dist'),
- },
- ],
- }),
- ],
entry: {
pushNotif: './push-notif/service-worker.js',
database: './database/worker/db-worker.js',
@@ -118,6 +108,36 @@
},
};
+const devWebWorkersPlugins = [
+ new CopyPlugin({
+ patterns: [
+ {
+ from: 'node_modules/sql.js/dist/sql-wasm.wasm',
+ to: path.join(__dirname, 'dist', 'webworkers'),
+ },
+ ],
+ }),
+];
+
+const prodWebWorkersPlugins = [
+ new CopyPlugin({
+ patterns: [
+ {
+ from: 'node_modules/sql.js/dist/sql-wasm.wasm',
+ to: path.join(
+ __dirname,
+ 'dist',
+ 'webworkers',
+ 'sql-wasm.[contenthash:12].wasm',
+ ),
+ },
+ ],
+ }),
+ new WebpackManifestPlugin({
+ publicPath: '',
+ }),
+];
+
module.exports = function (env) {
const browserConfig = env.prod
? createProdBrowserConfig(baseProdBrowserConfig, babelConfig)
@@ -130,9 +150,14 @@
...nodeConfig,
mode: env.prod ? 'production' : 'development',
};
+
+ const workersConfig = {
+ ...baseWebWorkersConfig,
+ plugins: env.prod ? prodWebWorkersPlugins : devWebWorkersPlugins,
+ };
const webWorkersConfig = createWebWorkersConfig(
env,
- baseWebWorkersConfig,
+ workersConfig,
babelConfig,
);
return [browserConfig, nodeServerRenderingConfig, webWorkersConfig];

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 7:11 AM (21 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2610758
Default Alt Text
D7092.id23835.diff (3 KB)

Event Timeline