Does not work with async plugins
See original GitHub issueWhat 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
- Related
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:
- Created 5 years ago
- Reactions:4
- Comments:15 (12 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 fineThought 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 🎉 😄