Skip to content

Decorators are not officially supported yet in 6.x pending a proposal update. #1

@ahyanarizky

Description

@ahyanarizky

I got this error when i try to use your packages :

ERROR in ./src/app/home/index/sales/SalesInvoiceNew.js
Module build failed: SyntaxError: Decorators are not officially supported yet in 6.x pending a proposal update.
However, if you need to use them you can install the legacy decorators transform with:

npm install babel-plugin-transform-decorators-legacy --save-dev

and add the following line to your .babelrc file:

{
  "plugins": ["transform-decorators-legacy"]
}

The repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy.

i have did what the error said, reset app and bundler (I am using webpack), but its not helping. Can you help?

here is my .babelrc :

{
    "presets": [
        "react",
        "es2015",
        "stage-0"
    ],
    "plugins": ["transform-decorators-legacy"] 
}

my models :

const activePolicy = Policy({
    test: props => props.expired_days > 0
})

@activePolicy
class createButtonActive extends Component {
    static propTypes = {
        expired_days: PropTypes.integer
    }

    render() {
        return (
            <RaisedButton onClick={this.createInvoice} label="Create" primary={true} labelStyle={{fontSize:'12px'}} />
        )
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions