Skip to content

How can I use proposal-decorators plugin in @babel/standalone environment? #16182

Answered by liuxingbaoyu
reosablo asked this question in Q&A
Discussion options

You must be logged in to vote

As a temporary solution, you can set an empty data-plugins.

    <script type="text/babel" data-presets="env-plus" data-plugins="">
        function decorateFoo(constructor) {
            constructor.prototype.foo = 42;
        }

        @decorateFoo
        class Example {
            constructor() { }
        }

        console.log(new Example().foo);
    </script>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@reosablo
Comment options

Answer selected by reosablo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants