question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not work with async plugins

See original GitHub issue

What happens and why it is wrong

This plugin does not work with plugin which containing async/await syntax caused by object-hash issue and tscache.ts. I think this is hard to fix object-hash because there is no way to detect asyncfunction now. So is there any alternative without object-hash?

Environment

Versions

  • typescript: 2.8.3
  • rollup: 2.1.1
  • rollup-plugin-typescript2: 0.14.0

rollup.config.js

import svgr from '@svgr/rollup';
import typescript from 'rollup-plugin-typescript2';

export default {
  // ...
  plugins: [
    replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }),
    svgr(),
    typescript({
      useTsconfigDeclarationDir: true,
    })
  ],
  // ...
};

tsconfig.json

No relevant.

package.json

No relevant.

plugin output with verbosity 3

[!] (rpt2 plugin) Error: Unknown object type "asyncfunction"
src/components/atoms/Icon/index.ts
Error: Unknown object type "asyncfunction"
    at Object._object (/Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:218:17)
    at Object._function (/Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:319:14)
    at Object.dispatch (/Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:185:30)
    at /Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:246:18
    at Array.forEach (<anonymous>)
    at Object._object (/Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:242:21)
    at Object.dispatch (/Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:185:30)
    at /Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:260:23
    at Array.forEach (<anonymous>)
    at Object._array (/Users/vwxyutarooo/Projects/kouzoh/mercari-web-jp-component/node_modules/rollup-plugin-typescript2/node_modules/object-hash/index.js:259:20)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
wessbergcommented, Aug 14, 2018

I must admit I’m surprised this haven’t been more of an issue so far since async functions are extremely common by now 😀. Which is also why I think that simply ignoring it will lead to a great deal of cache issues. The PR I submitted to object-hash some time ago was a consequence of this very issue, and I would suggest that you remove the dependency on object-hash. I’m pretty confident that the PR submitted some time ago would work just fine since it matches on the same value as provided in the error message and passed both unit tests and solved the issues in this plugin, so feel free to depend on the PR rather than the NPM package here.

@vwxyutarooo, an immediate workaround is to set clean: true in the config to bypass the cache completely. Alternatively (sorry for the plug) I built https://github.com/wessberg/rollup-plugin-ts which will also work just fine

3reactions
agilgur5commented, May 7, 2022

Thought I’d add an update for folks here that the root cause here was finally fixed in https://github.com/puleos/object-hash/pull/90 (very similar to https://github.com/puleos/object-hash/pull/68 referenced above) and here in #203. No need to use objectHashIgnoreUnknownHack to support async plugins and no more cache issues – was just released as v0.26.0 🎉 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugin is running fine in async mode but gives error on sync ...
Hi,. When I register my plugin in synchronous mode it gives error "Null Pointer Exception" but when I register the plugin on asynchronous ......
Read more >
post operation async plugin is not firing on CRM on Premise
1 Answer 1 · Try to change it to sync plugin & verify if it trigger at all. You can throw InvalidpluginExecutionException in...
Read more >
Gotcha: Plugin Running Async
Gotcha: Plugin Running Async. Generally when you want run a set of tasks that are not realtime, you would do this via Workflow....
Read more >
Async JavaScript doesn't work with oxygen - WordPress.org
Salut Gerald; As YouTube video's are loaded in an iframe, the JS in the iframe is out of reach of AsyncJS. Consider using...
Read more >
CRM Plugins and Asynchronous vs Synchronous - EHTC Digital
Dynamics 365 CRM has the ability to run your own custom C# code on ... Normally if the plugin is not asynchronous (or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found