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

(fix): upgrade rpts2 / object-hash to support async rollup plugins #506

Merged

Conversation

agilgur5
Copy link
Collaborator

  • object-hash v2.0.2 adds/fixes support for async functions

  • rpts2 v0.26.0 upgrades object-hash to v2.0.2

    • rpts2 currently bundles several of its dependencies, so they can't be
      overridden manually and that's also why the object-hash change isn't
      visible in the yarn.lock file
  • previously, TSDX users who wanted to use rollup plugins (via
    tsdx.config.js) that use async/await internally (e.g.
    rollup-plugin-copy, rollup-plugin-url, rollup-plugin-visualizer,
    rollup-plugin-smart-asset, etc, etc, etc), would run into
    'Unknown object type "asyncfunction"' from object-hash as rpts2
    hashes the rollup config itself for caching

    • the only fix was to hackily override the rpts2 config in
      tsdx.config.js (which requires brittle copy+paste as its config
      isn't exposed) and then use a config option of rpts2,
      objectHashIgnoreUnknownHack (which is hacky, per the name)
      • this could cause stale cache issues, or, if used with clean,
        would disable the cache entirely, both of which are suboptimal
        experiences
    • now this really common issue is solved and there's no hacking
      needed to use plugins that make use of async/await

NOTE: this does not affect source code that uses async/await, that
was already supported, this just affects plugins (in tsdx.config.js)
that use async/await


Phew, finally got here after puleos/object-hash#90 and ezolenko/rollup-plugin-typescript2#203 got merged and released.

Fixes #294 (the underlying root cause to be specific) and should simplify a lot in #379 and #278 , as well as unblock #358 and #496 .

With regard to rpts2 bundling some of its own dependencies, see ezolenko/rollup-plugin-typescript2#80, ezolenko/rollup-plugin-typescript2#70 .

- object-hash v2.0.2 adds/fixes support for async functions
- rpts2 v0.26.0 upgrades object-hash to v2.0.2
  - rpts2 currently bundles several of its dependencies, so they can't be
    overridden manually and that's also why the object-hash change isn't
    visible in the yarn.lock file

- previously, TSDX users who wanted to use rollup plugins (via
  tsdx.config.js) that use async/await internally (e.g.
  rollup-plugin-copy, rollup-plugin-url, rollup-plugin-visualizer,
  rollup-plugin-smart-asset, etc, etc, etc), would run into
  'Unknown object type "asyncfunction"' from object-hash as rpts2
  hashes the rollup config itself for caching
  - the only fix was to hackily override the rpts2 config in
    tsdx.config.js (which requires brittle copy+paste as its config
    isn't exposed) and then use a config option of rpts2,
    objectHashIgnoreUnknownHack (which is hacky, per the name)
    - this could cause stale cache issues, or, if used with clean,
      would disable the cache entirely, both of which are suboptimal
      experiences
  - now this really common issue is solved and there's no hacking
    needed to use plugins that make use of async/await

NOTE: this does not affect source code that uses async/await, that
was already supported, this just affects plugins (in tsdx.config.js)
that use async/await
@jaredpalmer
Copy link
Owner

Awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: upstream Issue in upstream dependency topic: rollup-plugin-typescript2 Issues and PRs relating to rpts2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support async rollup plugins / objectHashIgnoreUnknownHack flag from rpt2
2 participants