ReSub: Compiler error using @key decorator
I have tested the simpler subscription examples successfully, and now I am trying autosubscriptions using the @key decorator, such as in your example:
@autoSubscribe
getTodosForUser(@key username: string) {
return this._todosByUser[username];
}
Unfortunately, I get a compiler error:
Error: Module parse failed: Unexpected character ‘@’ (1:20609) You may need an appropriate loader to handle this file type.
It seems like Babel has a problem with the @key decorator being used within a function, and not with other decorators like @autoSubscribe and @AutoSubscribeStore.
I’ve checked my babel.config.js and everything seems OK, using:
const plugins = [
['@babel/plugin-proposal-decorators', { legacy: true }],
["@babel/plugin-proposal-class-properties", { "loose": true}]
];
Did someone else come across this problem? Any recommendation on how to solve this?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (2 by maintainers)
Commits related to this issue
- Update Readme to address #98 — committed to microsoft/ReSub by berickson1 5 years ago
- Update readme to address #98 (#109) * Update Readme to address #98 * Update README.md — committed to microsoft/ReSub by berickson1 5 years ago
Hi @thegalah,
Thanks for the feedback, I had a quick fix in
1.0.9. Hope all good if you try with this version.Several of the unit tests use @key. You can start with one of those build systems.