Ignore https-proxy-agent
dependency in browser environments
#2133
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.
High Level Overview of Change
This change ignores
https-proxy-agent
from browser environments inpackage.json
, mirroring the existing content in https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/webpack.config.js#L59Context of Change
With some effort in our Vite.js based project, we were able to polyfill node dependencies to resolve this known issue.
However, this fix did not extend to our Cypress test environment. With a working Vite configuration, running Cypress tests yields:
To get Cypress tests running, we:
@bahmutov/cypress-esbuild-preprocessor
to polyfill esbuild node dependencies to match those in our Vite configuration (including aliases)"https-proxy-agent": false
to xrpl.jspackage.json
'sbrowser
field.This has the effect of ignoring
http-proxy-agent
in browser environments, which clears up the error and allows Cypress tests to run. See the spec for more information.Linting changes
This change (adding a boolean value to
package.json
) triggers this bug in eslint-plugin-import, which motivated the temporary disablement of theimport/no-unused-modules
linting rule. After the eslint-plugin-import bug is fixed,import/no-unused-modules
can be enabled again (e.g. revert this commit and turn back onimport/no-unused-modules
Type of Change
Before / After
https-proxy-agent
is no longer included in browser environments.