Open andrey-shostik opened 5 years ago
I got the same problem
@super918180 I fixed this issue with following steps:
@babel/plugin-proposal-decorators
But I'm not sure that it is right way.
if you are using latest rn,the rn-cli.config.js should be like this
module.exports = { transformer: { babelTransformerPath: require.resolve('react-native-typescript-transformer'), }, };
you can follow the metro-bundler document
https://facebook.github.io/metro/docs/en/configuration
if you are using latest rn,the rn-cli.config.js should be like this
module.exports = { transformer: { babelTransformerPath: require.resolve('react-native-typescript-transformer'), }, };
you can follow the metro-bundler document https://facebook.github.io/metro/docs/en/configuration
It's work for me!
still bug decorators-legacy' isn't currently enabled
@andrey-shostik thanks! Could you please explain how your solution works?
Installing these two plugins and updating babel.config.js
seems to be working for me:
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose" : true }]
]
Error: Support for the experimental syntax 'decorators' isn't currently enabled Issue: I'm currently experiencing an issue with Babel when trying to use decorators in my JavaScript code. I've followed the official Babel documentation and created a .babelrc.json file with the necessary configuration, but I'm still getting the error
hers is .babelrc.json { "presets": ["@babel/preset-env", "@babel/preset-react"], "plugins": [ "@babel/plugin-transform-runtime", ["@babel/plugin-proposal-decorators", { "legacy": true }], ["@babel/plugin-proposal-class-properties"] ] } How to resolve this
I recently created app with typescript by this article, and I have error when trying to apply decorator to a method error screenshots: https://prnt.sc/l4nors, http://prntscr.com/l4np8r tsconfig: https://pastebin.com/UsczCQ70