Upgrade manifest v2 to v3

101 views
Skip to first unread message

Achal Singh

unread,
Aug 2, 2023, 2:45:56 AM8/2/23
to Chromium Extensions
Hi

I am updated manifest version of liquility wallet from v2 to v3.

I am stuck in background.js file

unable to load the node module in this file 

here is my code 

import 'setimmediate'
import { random } from 'lodash-es'
import store from './store'
import { wait } from './store/utils'
import cryptoassets from '@liquality/wallet-core/dist/src/utils/cryptoassets'
import { unitToCurrency } from '@liquality/cryptoassets'
import { prettyFiatBalance } from '@liquality/wallet-core/dist/src/utils/coinFormatter'
import _ from 'lodash-es'
import { version as walletVersion } from '../package.json' it working in manifest v2 but not working now can anyone help me in this

wOxxOm

unread,
Aug 2, 2023, 4:21:58 AM8/2/23
to Chromium Extensions, Achal Singh
What is the error text? This library may be using `window` or other DOM stuff, so you may need to use it inside the offscreen document and not in the service worker.

Achal Singh

unread,
Aug 2, 2023, 5:03:22 AM8/2/23
to Chromium Extensions, wOxxOm, Achal Singh
Thanks for reply

yes, I getting the window error

have you any example how i can do that, as I am unable to call the node module in off screen document. 

any reference will be helpful



wOxxOm

unread,
Aug 2, 2023, 5:11:33 AM8/2/23
to Chromium Extensions, Achal Singh, wOxxOm

Achal Singh

unread,
Aug 2, 2023, 8:43:48 AM8/2/23
to Chromium Extensions, wOxxOm, Achal Singh
i tried above method but getting another error

window is not define

I attached the screenshot

Thanks
Screenshot from 2023-08-02 18-13-02.png

wOxxOm

unread,
Aug 2, 2023, 9:06:51 AM8/2/23
to Chromium Extensions, Achal Singh, wOxxOm
You're not using the example correctly (you need to remove this library from background.js and move it into offscreen.js) or you look at an old error (the chrome://extensions UI retardedly doesn't show timestamps for the errors so you should clear them manually by clicking the corresponding button).

Achal Singh

unread,
Aug 2, 2023, 9:09:20 AM8/2/23
to Chromium Extensions, wOxxOm, Achal Singh
I removed the import code

I just paste the whole code of example
Screenshot from 2023-08-02 18-38-21.png
Reply all
Reply to author
Forward
0 new messages