getappmap / appmap-agent-js

This project is deprecated. Please use https://github.com/getappmap/appmap-node/ to record Node.js applications.
Other
27 stars 8 forks source link

Decorators in typescript parse error #97

Open iSuslov opened 2 years ago

iSuslov commented 2 years ago

Hi, I have decorators in my code and getting this error after recording stops:

APPMAP-ERROR Unrecoverable parsing error at file "src/myfile.tsx" >> This experimental syntax requires enabling one of the following parser plugin(s): "decorators-legacy", "decorators".

iSuslov commented 2 years ago

I would appreciate if someone will point me to the right direction of how I can create a workaround. Basically I need to edit babel config, not clear how.

iSuslov commented 2 years ago

Was able to make it work by adding to array on this line https://github.com/applandinc/appmap-agent-js/blob/3b16f41f513bb652626c0d344a5f3ac90489f580/components/trace/appmap/classmap/estree/parse.mjs#L49 'decorators-legacy' string

lachrist commented 2 years ago

Hi @iSuslov thanks a lot for your involvment! You pinpointed the right location where to make change. The problem is that we cannot just enable all plugins at once because they may be incompatible with each others. What we could do is provide the user with configuration options to select babel plugins. @kgilpin what do you think?

dustinbyrne commented 2 years ago

If there's no API to retrieve a list of enabled syntax plugins from Babel I'd say that exposing end-user configuration would be our next best bet.