Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update affjax v12 to v13 #1430

Closed
SeungheonOh opened this issue Feb 14, 2023 · 3 comments · Fixed by #1521
Closed

Update affjax v12 to v13 #1430

SeungheonOh opened this issue Feb 14, 2023 · 3 comments · Fixed by #1521
Assignees
Labels

Comments

@SeungheonOh
Copy link

SeungheonOh commented Feb 14, 2023

affjax v12 is broken when bundled with webpack. It uses module.require to detect the environment(node or web), but webpack does not defined module.require resulting in it generating node bundles using XMLHttpRequest instead of xhr2 node module, and requests failing with Error: (ClientHttpError There was a problem making the request: XMLHttpRequest is not defined). In short, it will always assume webpack is generating browser bundle.

Looks like v13 allows environment detection to be handled by user by giving affjax-web and affjax-node modules. It would be nice to update affjax version.

@klntsky
Copy link
Member

klntsky commented Feb 14, 2023

We are on PS v0.14*, but v13 is for PS 0.15. Sadly, we can't upgrade right now in a short time frame. I see two possible quick solutions for you:

  • do not bundle for NodeJS with webpack
  • try to set module.require manually - if the dispatching is done at runtime, it could help (I am not sure about that)
  • is there a polyfill for XMLHttpRequest for NodeJS?

related: #1414

@klntsky
Copy link
Member

klntsky commented Feb 14, 2023

Another problem I see here is that it does not allow to write platform-agnostic code. We can't really dispatch on dependencies based on runtime options, at least our existing setup does not have this option.

@SeungheonOh
Copy link
Author

SeungheonOh commented Feb 14, 2023

I see, I didn't know it had different PS version. In Liqwid, I was able to fix it by using revision of affjax(e717b1).

Alternatively, perhaps would it be nice to include docker image builder that does not bundle with webpack on CTL nix infrastructure? Currently, we use bundlePursProject, but I think it can be done without bundling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants