{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/8979","repository_url":"https://api.github.com/repos/babel/babel","labels_url":"https://api.github.com/repos/babel/babel/issues/8979/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/8979/comments","events_url":"https://api.github.com/repos/babel/babel/issues/8979/events","html_url":"https://github.com/babel/babel/issues/8979","id":377749070,"node_id":"MDU6SXNzdWUzNzc3NDkwNzA=","number":8979,"title":"Class static properties, referenced in other static properties isn't transpiled well when using decorators.","user":{"login":"andriimiroshnychenko","id":42540438,"node_id":"MDQ6VXNlcjQyNTQwNDM4","avatar_url":"https://avatars2.githubusercontent.com/u/42540438?v=4","gravatar_id":"","url":"https://api.github.com/users/andriimiroshnychenko","html_url":"https://github.com/andriimiroshnychenko","followers_url":"https://api.github.com/users/andriimiroshnychenko/followers","following_url":"https://api.github.com/users/andriimiroshnychenko/following{/other_user}","gists_url":"https://api.github.com/users/andriimiroshnychenko/gists{/gist_id}","starred_url":"https://api.github.com/users/andriimiroshnychenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andriimiroshnychenko/subscriptions","organizations_url":"https://api.github.com/users/andriimiroshnychenko/orgs","repos_url":"https://api.github.com/users/andriimiroshnychenko/repos","events_url":"https://api.github.com/users/andriimiroshnychenko/events{/privacy}","received_events_url":"https://api.github.com/users/andriimiroshnychenko/received_events","type":"User","site_admin":false},"labels":[{"id":953231884,"node_id":"MDU6TGFiZWw5NTMyMzE4ODQ=","url":"https://api.github.com/repos/babel/babel/labels/Spec:%20Decorators%20(Legacy)","name":"Spec: Decorators (Legacy)","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-06T09:01:35Z","updated_at":"2018-11-06T09:37:50Z","closed_at":null,"author_association":"NONE","body":"## Bug Report\r\n\r\n**Current Behavior**\r\nGiven that I'm using decorators.\r\nIf I try to reference static properties of a class inside another static property of the same class, I will get runtime error.\r\n\r\n**Input Code**\r\nPlease check here, there is a bit detailed description and steps to reproduce.\r\nhttps://github.com/andriimiroshnychenko/small-repro\r\n\r\nThis repo uses MobX as a source of decorators, but I tried also another libraries and they threw same error.\r\n\r\n**Expected behavior/code**\r\nNo runtime error should appear.\r\n\r\n**Babel Configuration (.babelrc, package.json, cli command)**\r\n\r\n```js\r\nmodule.exports = api => {\r\n    api.cache(false);\r\n\r\n    return {\r\n        presets: [\r\n            [\r\n                '@babel/preset-env',\r\n                {\r\n                    targets: {\r\n                        browsers: ['last 2 Chrome versions', 'last 2 Safari versions', 'last 2 Firefox versions']\r\n                    },\r\n                    modules: false,\r\n                    forceAllTransforms: true\r\n                }\r\n            ],\r\n            '@babel/preset-typescript'\r\n        ],\r\n        plugins: [\r\n            ['@babel/plugin-proposal-decorators', { legacy: true }],\r\n            ['@babel/plugin-proposal-class-properties', { loose: true }],\r\n        ]\r\n    };\r\n};\r\n```\r\n\r\n**Environment**\r\n- Babel version(s): ^7.1.0\r\n- Node/npm version: Node 8.11.4/npm 5.6.0\r\n- OS: Ubuntu 16.04\r\n- Monorepo: no\r\n- How you are using Babel:  `loader`"},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/436189595","html_url":"https://github.com/babel/babel/issues/8979#issuecomment-436189595","issue_url":"https://api.github.com/repos/babel/babel/issues/8979","id":436189595,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjE4OTU5NQ==","user":{"login":"andriimiroshnychenko","id":42540438,"node_id":"MDQ6VXNlcjQyNTQwNDM4","avatar_url":"https://avatars2.githubusercontent.com/u/42540438?v=4","gravatar_id":"","url":"https://api.github.com/users/andriimiroshnychenko","html_url":"https://github.com/andriimiroshnychenko","followers_url":"https://api.github.com/users/andriimiroshnychenko/followers","following_url":"https://api.github.com/users/andriimiroshnychenko/following{/other_user}","gists_url":"https://api.github.com/users/andriimiroshnychenko/gists{/gist_id}","starred_url":"https://api.github.com/users/andriimiroshnychenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andriimiroshnychenko/subscriptions","organizations_url":"https://api.github.com/users/andriimiroshnychenko/orgs","repos_url":"https://api.github.com/users/andriimiroshnychenko/repos","events_url":"https://api.github.com/users/andriimiroshnychenko/events{/privacy}","received_events_url":"https://api.github.com/users/andriimiroshnychenko/received_events","type":"User","site_admin":false},"created_at":"2018-11-06T09:37:50Z","updated_at":"2018-11-06T09:37:50Z","author_association":"NONE","body":"In my small repo with this config\r\n```\r\n        plugins: [\r\n            ['@babel/plugin-proposal-decorators'],\r\n            ['@babel/plugin-proposal-class-properties']\r\n        ]\r\n```\r\nI got this error\r\n```\r\nModule build failed: Error: [BABEL] /home/amiro/project/small-repro/src/index.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: \"/home/amiro/project/small-repro/node_modules/@babel/plugin-proposal-decorators/lib/index.js\")\r\n```\r\nAfter enabling `decoratorsBeforeExport` error was changed to:\r\n```\r\nTypeError: An element descriptor's .kind property must be either \"method\" or \"field\", but a decorator created an element descriptor with .kind \"undefined\"\r\n```\r\nDespite this, bug is revealed in large project, where mix of different decorators exists. So It will be very helpful to get some fix/workaround to get it through with `legacy: true`"}}
{"actor":{"display_login":"andriimiroshnychenko"}}