Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Export browser and nodejs compatible buffer from lisk-client #6817

Closed
ManuGowda opened this issue Oct 4, 2021 · 1 comment
Closed

Export browser and nodejs compatible buffer from lisk-client #6817

ManuGowda opened this issue Oct 4, 2021 · 1 comment

Comments

@ManuGowda
Copy link
Contributor

Description

lisk-client library should be allowed to use both node and browser version. e.g import * as liskClient from 'lisk-client/node,import * as liskClient from 'lisk-client/browser. and the default behaviour can be supported for browser import * as liskClient from 'lisk-client.

Motivation

Lisk Desktop and Lisk Mobile testing environment requires the both browser buffer (due to lisk-client) and nodejs buffer (due to btc libraries). Supporting both the buffer instances is a challenge, if we an ability to import lisk-client as nodejs, then both will be supported

Additional Information

LiskHQ/lisk-desktop#3804
LiskArchive/lisk-mobile#1102

@shuse2 shuse2 added this to the Sprint 54 milestone Oct 4, 2021
@shuse2 shuse2 closed this as completed Oct 6, 2021
@shuse2 shuse2 changed the title Export browser and nodejs buffer compatible lisk-client Export browser and nodejs compatible buffer from lisk-client Oct 13, 2021
@shuse2 shuse2 reopened this Oct 28, 2021
@shuse2
Copy link
Collaborator

shuse2 commented Oct 28, 2021

Reopening this issue because with @chainsafe/blst library included in the lisk-cryptography library, the faucet ui build will fail with below if we use node version of lisk-client library.

 ❯ CI=true yarn build:web
yarn run v1.22.10
$ node scripts/build.js --jsx react
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

/lisk-sdk/node_modules/@chainsafe/blst/dist/bindings.js
Critical dependency: the request of a dependency is an expression


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This error is because of webpack/webpack#196.

With Typescript, it is not possible to use exports feature on package.json yet, but it will be available in next 4.5. microsoft/TypeScript#33079.

Most likely, even if the exports will be supported, webpack build will fail with the above error. Therefore, browser version to be the default seems to make more sense for lisk-client package.

Temporally reverting the change to default to browser version of the build with 34849e0 in #6869.

When fixing this again, lisk-desktop/lisk-mobile developers must be consulted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants