Sunday, 2 December 2018

Babel plugin-proposal-decorators not working as expected

I have added devDependencies at package.json. Here are versions.

"@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-decorators": "^7.1.6",

In .babelrc a file I have added them as plugins

{
    "presets": ["module:metro-react-native-babel-preset"],
    "plugins": [
        ["@babel/plugin-proposal-decorators", { "legacy": true}],
        ["@babel/plugin-proposal-class-properties", { "loose": true}]
    ]
}

I am using mobx so observable is the clean syntax. I am making a file like this:

class AppStore {
  @observable username = ''
}

export default (new AppStore())

But it is always showing this.

enter image description here

I think I have done it correctly. And is there no way to detect whether babel plugins are loaded or not. It's so frustrating error :(



from Babel plugin-proposal-decorators not working as expected

No comments:

Post a Comment