Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is about fixing the way we import modules from
near-api-js
.In our packages we import code from NAJ in this way:
Although this is not necessarily “wrong” there are no linting or build errors and when our packages are installed via npm/yarn everything seems to work just fine.
The problem shows up when the CDN link is used in a dApp to import our packages.
From more investigation, it was found that NAJ does not export named modules at the top level for
accountCreator, providers, utils, transactions, validators, multisig
somewhere in the code everything is first imported as an alias and then exported:So in the end the browser is not recognizing these exported modules as named modules when the CDN links are used.
This PR changes the way we import modules from
near-api-js
and to import everything like:Checklist:
Type of change.