-
Notifications
You must be signed in to change notification settings - Fork 184
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
create-react-app@2.1.8 typescript@3.4.1 Reflect.getMetadata("design:type", target, propertyKey) == undefined ? #104
Comments
I'm having the same issue. It looks like it comes from here facebook/create-react-app#6388 which leads to babel/babel#9681. Basically, Babel doesn't support |
Had the same bug. But when i put
as the first ever line in
the issue was solved |
我是这样处理的...
const { useBabelRc } = require('customize-cra');
module.exports = override(
useBabelRc()
);
{
"plugins": [
"babel-plugin-transform-typescript-metadata",
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
],
"presets": [
"@babel/preset-typescript"
]
}
试了好多种方法 这种成功了 你试试看 |
also good for react native |
I try it. it is working for me. Tips: you should import reflect metadata to every file top line |
Actually importing reflect-metadata in every file can cause this problem. If there are two different versions of reflect-metadata in your module tree then multiple versions of reflect-metadata may get loaded. If this happens, you may end up with a sort of "split brain" where some metadata is in one version and some is in the other. Use Load |
Another thing that I had to do to make @liuxinya's answer work for an application running using Metro builder was to start the application using the command
|
Closing this as External as it seems to be an issue with Babel's emit.
This should hopefully no longer be an issue as of Also, the API surface of |
The text was updated successfully, but these errors were encountered: