Open simonihmig opened 2 years ago
I think the suggestion in that thread is correct, we should be adding the syntax plugin without adding the transform plugin.
Well, but the issue I described on that thread is that this does not work...
Sorry, I missed that, you're correct.
The problem here is that rollup's own parser (which is acorn) needs to understand the syntax. Which is unlikely to happen, because the legacy decorator syntax isn't really standards track -- the decorators proposal moves onward, but with different syntax.
I think instead we're going to need to move forward on having our own intermediate representation that is safe JS syntax. This is a good idea anyway -- publishing packages to NPM that general purpose JS tooling can't parse is not great.
The "Ember Language Standard" defined in the v2 spec supports shipping addon code with (legacy) decorators. However the build support for v2 addons in
@embroider/addon-dev
uses Babel, which fails to parse decorators code when not transforming them.This is described in more detail in https://github.com/babel/babel/discussions/13927, and probably an issue of Babel itself. But raising this here for visibility and tracking.
The only workaround I found was to add the plugins that actually transform decorators.