-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Functional example of decorators? #40
Comments
Hi @Strnadj Have you tried this recipe? https://github.com/sharegate/craco/tree/master/recipes/use-mobx |
Yes, we have tried that, but it fails with the error message above. |
There is a few options for the babel decorator plugin: https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.htm Have you tryed without the
|
Ok, if I delete that: Error: [BABEL] /Users/strnadj/Projects/test/node_modules/react-dev-utils/webpackHotDevClient.js: The decorators plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you want to use the legacy decorators semantics, you can set the 'legacy: true' option. (While processing: "/Users/strnadj/Projects/test/node_modules/@babel/plugin-proposal-decorators/lib/index.js")
at Array.reduce (<anonymous>) so I have change that to:
and error:
|
I tryed it on my side and it works fine. Is there something else in your setup that add the |
https://github.com/Strnadj/not_working_cra there is repository, what cames in my mind... it seems to "@babel/plugin-proposal-decorators" is not ready yet for @babel 7.1..
not sure if it is a problem, but I was not able to find react-scripts version with @babel 7.0 in dependencies. |
Maybe it's the problem, if it's the case you should open an issue in the For this issue, it doesn't seem to be a problem with If you find the right I will leave the issue open for a few days in case someone have a solution for you. |
Hi @patricklafrance
and it work in craco start and craco build |
Hi @duyucongc It works fine in my sandbox. My version of the following packages version are: @babel/core@7.1.0 With the following craco.config.js file
|
@duyucongc https://www.npmjs.com/package/@craco/craco/v/3.2.2 should fix your problem . |
I will close this issue since there isn't any new comments for 7 days |
Thank you, this did solve my problem. I originally planned to use mobx directly without using the decorator. |
@patricklafrance thank you it did work for me |
We are trying to use http://inversify.io/, it uses attribute decorators to inject:
but if I try to use
mobX
configuration (add decorator support), I am still getting:I think this issue is caused by the configuration of webpack in CRA, they are not using ts-loader, but I am not sure.
The text was updated successfully, but these errors were encountered: