reductive icon indicating copy to clipboard operation
reductive copied to clipboard

Broken build with in-source compilation

Open rusty-key opened this issue 6 years ago • 1 comments

After trying to use reductive in a fresh project, I experienced this runtime error:

Uncaught TypeError: f.apply is not a function
    at app (curry.js:12)
    at curry_2 (curry.js:131)
    at Module._2 (curry.js:143)
    at Module.element (ReasonReact.js:538)
    at Module../src/index.re (index.re:14)
    at __webpack_require__ (bootstrap:782)
    at fn (bootstrap:150)
    at Object.0 (thunkedStore.re:58)
    at __webpack_require__ (bootstrap:782)
    at checkDeferredModules (bootstrap:45)
    at Array.webpackJsonpCallback [as push] (bootstrap:32)
    at main.chunk.js:1

The problem only occurs if I use in-source compilation. If I switch to in-source: false, it works perfectly fine.

After a bit of digging, I noticed that reductive depends on two versions of bs-platform: https://github.com/reasonml-community/reductive/blob/d9903eb7a128edfa097f42d970c73775e9d24bd6/yarn.lock#L419-L427 one of which is a dependency of immuatable-re: https://github.com/reasonml-community/reductive/blob/d9903eb7a128edfa097f42d970c73775e9d24bd6/yarn.lock#L1236-L1240 https://github.com/facebookincubator/immutable-re/blob/master/package.json#L39

I've tried to patch version and looks like it solves the problem: https://github.com/facebookincubator/immutable-re/compare/master...rusty-key:bs-platform https://github.com/reasonml-community/reductive/compare/master...rusty-key:bs-platform

Here are "minimal" examples: https://github.com/rusty-key/reductive-broken-compilation-example/

Because of very experimental state of immutable-re I am not sure if this upgrade will not break something but I submitter PR anyway: https://github.com/facebookincubator/immutable-re/pull/103

@rickyvetter, what do you think?

rusty-key avatar Jan 09 '19 14:01 rusty-key

Thanks for submitting a PR on immutable-re! I think we can probably move to use Belt data structures if you want a fix that doesn't depend on another repo. Belt is more stable, is actively supported, and doesn't introduce a new dependency since it ships with bs-platform.

rickyvetter avatar Jan 10 '19 15:01 rickyvetter