This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
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.
The package doesn't work with Next.js because the way it's built it includes many dependencies in the bundle compiled for browser. So those dependencies try to access
window
and other stuff available in browser only, which break during SSR in Next.jsThis PR includes:
react
(bad idea to bundle it -- causes conflicts with user version, 16 vs 17),web3
-- accesseswindow.btoa
,popper.js
used by an old version ofsemantic-ui
would try to do something withwindow
, and evenstyle-loader
-- for injecting styles intodocument.head
For Next.js those dependencies either have to work equally in browser and in server, or -- the easier way -- leave their compilation to Next.js build (670ac93) and extract css to be included separately
react
intopeerDependencies
to make PWidget build independent of react version, user can use react v17 for example (a0c3d94)Global CSS cannot be imported from files other than your Custom <App>
error we have to extract all css (assemantic-ui-css
is global) and leave it to the user toimport 'paraswap-widget/dist/PSWidget.css'
somewhere (0dc7ef7)paraswap
dependency returned 404, so I updated that, which caused updatesto types and typescript(to accomodate a newerasserts type
syntax ints-essentials
) (e7d63aa)PSWidget::currentProvider
was wrong and never returnedwindow.ethereum
when it was available, thus preventing any provider connection (05df2f9)Here are example repos built with my fork of PWidget:
Next.js
Create-react-app