decorator support
See original GitHub issueHi! I am trying to add mobx to a project, I have proper transformer added to my .babelrc, but the compilation keeps failing!
Here is my .babelrc
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
'@babel/preset-stage-2',
'@babel/preset-flow',
'@babel/preset-react',
"@babel/preset-es2015",
"@babel/preset-stage-1"
],
plugins: [
"@babel/plugin-proposal-decorators"
],
ignore: ['node_modules', 'build'],
};
Here is the error
ERROR in ./src/routes/admin/Admin.js
Module build failed: SyntaxError: /WorkSpace/opalcoin/opalweb/src/routes/admin/Admin.js: Support for the experimental syntax 'decorators' isn't currently enabled (16:1):
14 | import {Provider, observer, inject} from 'mobx-react';
15 |
> 16 | @observer
| ^
17 | @inject("uistore")
18 | class Admin extends React.Component {
19 | static propTypes = {
Add @babel/plugin-proposal-decorators (https://git.io/vb4ST) to the 'plugins' section of your Babel config to enable transformation.
at _class.raise (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:832:15)
at _class.expectOnePlugin (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:2229:18)
at _class.parseDecorator (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:4373:10)
at _class.parseDecorators (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:4355:28)
at _class.parseStatement (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:4203:12)
at _class.parseStatement (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:6998:55)
at _class.parseBlockOrModuleBlockBody (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:4764:23)
at _class.parseBlockBody (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:4750:10)
at _class.parseTopLevel (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:4174:10)
at _class.parse (/WorkSpace/opalcoin/opalweb/node_modules/@babel/core/node_modules/babylon/lib/index.js:5613:17)
@ ./src/routes/admin/index.js 13:0-28
@ ./src/routes/index.js
@ ./src/router.js
@ ./src/client.js
@ multi @babel/polyfill ./tools/lib/webpackHotDevClient ./src/client.js
This does look like a babel issue, but has anyone recently integrated mobx with react-starter-kit? Thanks a lot!
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Decorators | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >Documentation - Decorators - TypeScript
A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use...
Read more >How To Use Decorators in TypeScript - DigitalOcean
One of those extra features is decorator support. Decorators are a way to decorate members of a class, or a class itself, ...
Read more >Native Decorator Support (3.10) | What's New in Ember
Native Decorator Support (3.10). Learn what Ember's commitment to Stage 1 Decorators means for your app code. What's New in Ember. 10 ...
Read more >evanw/esbuild · GitHub - Feature request: Decorators support
So I'm not planning on supporting decorators based on the spec, at least not any time soon. Separate from that, decorators in TypeScript...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I could make decorators work.
Here my .babelrc.js:
webpack.config.js
messages.js
@langpavel me too. No longer using decorators