Skip to content

Commit 753a457

Browse files
committed
Fix extension build
1 parent 29f58de commit 753a457

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

extension/extension.vite.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export default defineConfig({
1818
'offscreen': resolve(__dirname, 'src/service-worker/offscreen/index.html'),
1919
'content-script': resolve(__dirname, 'src/content-script/index.ts'),
2020
'service-worker': resolve(__dirname, 'src/service-worker/index.ts'),
21-
// HACK: ensure this is a separate output chunk
22-
'client': resolve(__dirname, 'src/client.ts'),
21+
'linera-client': '@linera/client',
2322
},
2423
preserveEntrySignatures: 'strict',
2524
output: {

extension/library.vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export default defineConfig({
1414
name: 'linera-web',
1515
fileName: 'linera',
1616
},
17+
rollupOptions: {
18+
external: ['@linera/client'],
19+
},
1720
},
1821
resolve: {
1922
alias: {

extension/src/client.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

extension/src/wallet/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import * as wasm from '@/client';
2-
import type { Client } from '@/client';
1+
import * as linera from '@linera/client';
2+
import type { Client } from '@linera/client';
33

4-
import wasmModuleUrl from '@linera/client/pkg/linera_web_bg.wasm?url';
54
import * as guard from './message.guard';
65

76
export class Server {
@@ -11,8 +10,8 @@ export class Server {
1110

1211
async setWallet(wallet: string) {
1312
this.wallet = wallet;
14-
await wasm;
15-
this.client = await new wasm.Client(await wasm.Wallet.fromJson(wallet));
13+
await linera;
14+
this.client = await new linera.Client(await linera.Wallet.fromJson(wallet));
1615
this.client.onNotification((notification: any) => {
1716
console.debug('got notification for', this.subscribers.size, 'subscribers:', notification);
1817
for (const subscriber of this.subscribers.values()) {
@@ -22,9 +21,7 @@ export class Server {
2221
}
2322

2423
async init() {
25-
await (await wasm).default({
26-
module_or_path: (await fetch(wasmModuleUrl)).arrayBuffer(),
27-
});
24+
await (await linera).default();
2825

2926
chrome.runtime.onConnect.addListener(port => {
3027
if (port.name !== 'notifications') {

0 commit comments

Comments
 (0)