thomashoneyman / purescript-halogen-realworld

Exemplary real world application built with PureScript + Halogen
https://thomashoneyman.com/guides/real-world-halogen
MIT License
792 stars 86 forks source link

Create dev target for Parcel to exclude xhr2 dependency #101

Closed sjpgarcia closed 2 years ago

sjpgarcia commented 2 years ago

I couldn't track which commit introduces this but the serve-dev script fails with the following warning about xhr2. This also regenerates the lockfile as weak-lru-cache seems to hit 403s for some reason.

> purescript-halogen-realworld@ serve-dev /home/pure/Personal/PureScript/purescript-halogen-realworld
> parcel dev/index.html --open

Server running at http://localhost:1234
🚨 Build failed.

@parcel/core: Failed to resolve 'xhr2' from './output/Affjax/foreign.js'

  /home/pure/Personal/PureScript/purescript-halogen-realworld/output/Affjax/foreign.js:10:32
     9 |     platformSpecific.newXHR = function () {
  > 10 |       var XHR = module.require("xhr2");
  >    |                                ^^^^^^
    11 |       return new XHR();
    12 |     };
thomashoneyman commented 2 years ago

I don’t think xhr2 should be necessary on web (iirc it’s a node-only dependency). I think parcel may be hitting a code path it didn’t used to. Is there a way to tell parcel to exclude that dependency?

sjpgarcia commented 2 years ago

I don’t think xhr2 should be necessary on web (iirc it’s a node-only dependency).

Yikes, I forgot about this :sweat_smile:. It's been a quick while since I've done anything with Parcel + PureScript. There seems to be a way to exlude xhr2 though, so I'll be pushing that now.

sjpgarcia commented 2 years ago

Zephyr seems to takes care of the production code path so a target for production isn't needed :slightly_smiling_face:

thomashoneyman commented 2 years ago

Thanks!