Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lit-element + mobx legacy decorators #921

Closed
tamis-laan opened this issue Mar 12, 2020 · 2 comments
Closed

lit-element + mobx legacy decorators #921

tamis-laan opened this issue Mar 12, 2020 · 2 comments

Comments

@tamis-laan
Copy link

tamis-laan commented Mar 12, 2020

I'm trying to use lit-element together with mobx, for this i'm using webpack and bable. I'm using the folowing plugins for babel as described in the lit-element docs.

        plugins: [
          ['@babel/plugin-proposal-decorators',{decoratorsBeforeExport: true}],
          ['@babel/plugin-proposal-class-properties'],
        ]

The problem is that mobx requires legacy decorators and crashes when using @computed. However changing the above to:

        plugins: [
          ['@babel/plugin-proposal-decorators', {decoratorsBeforeExport: true, legacy:true}],
          ['@babel/plugin-proposal-class-properties', {legacy:true}],
        ]

Crashes babel with the error:
'decoratorsBeforeExport' can't be used with legacy decorators.

However removing 'decoratorsBeforeExport' breaks lit-element as property changes are no longer registered.

Is there some way to make the two play nice together??

@justinfagnani
Copy link
Contributor

Thanks for the heads up. This is unfortunate. I think the Babel and TypeScript implementations of "legacy" decorators differ slightly. I think we can make it work by checking the arguments to the decorators more carefully.

I don't how this will fall on our priorities for the near term, so we'd definitely take contributions here.

@justinfagnani
Copy link
Contributor

Seems to be a dupe of #205

I'm going to re-open #205 and close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants