{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ionic-app-scripts/issues/545","repository_url":"https://api.github.com/repos/driftyco/ionic-app-scripts","labels_url":"https://api.github.com/repos/driftyco/ionic-app-scripts/issues/545/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic-app-scripts/issues/545/comments","events_url":"https://api.github.com/repos/driftyco/ionic-app-scripts/issues/545/events","html_url":"https://github.com/driftyco/ionic-app-scripts/issues/545","id":195515054,"number":545,"title":"Custom decorators are stripped from AoT builds as of 0.0.47","user":{"login":"fiznool","id":820863,"avatar_url":"https://avatars.githubusercontent.com/u/820863?v=3","gravatar_id":"","url":"https://api.github.com/users/fiznool","html_url":"https://github.com/fiznool","followers_url":"https://api.github.com/users/fiznool/followers","following_url":"https://api.github.com/users/fiznool/following{/other_user}","gists_url":"https://api.github.com/users/fiznool/gists{/gist_id}","starred_url":"https://api.github.com/users/fiznool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiznool/subscriptions","organizations_url":"https://api.github.com/users/fiznool/orgs","repos_url":"https://api.github.com/users/fiznool/repos","events_url":"https://api.github.com/users/fiznool/events{/privacy}","received_events_url":"https://api.github.com/users/fiznool/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-14T12:11:09Z","updated_at":"2016-12-14T12:56:43Z","closed_at":null,"body":"#### Short description of the problem:\r\n\r\nAn app which uses custom decorators (e.g. `ngrx/effects`) has those decorators stripped from the resulting production build.\r\n\r\n#### What behavior are you expecting?\r\n\r\nThe custom decorators to not be stripped, as is the case in 0.0.46.\r\n\r\n**Steps to reproduce:**\r\n1. Clone the repo https://github.com/fiznool/counter-ionic2-ngrx-effects\r\n2. Switch to the branch `app-scripts-47`\r\n3. Run `npm install`\r\n4. Run `ionic run android --aot` (or `ios`)\r\n5. In the resulting app, increment the counter using the 'Increment' button.\r\n6. Attempt to reset the counter with the 'Reset' button.\r\n\r\nThe 'Reset' button uses `ngrx/effects`, which in turn depends on a custom decorator, `@Effect`. This is stripped from the build with 0.0.47 so the effect does not run, and hence the counter is not reset.\r\n\r\n**Which @ionic/app-scripts version are you using?**\r\n\r\n0.0.47\r\n\r\n**Other information:** (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)\r\n\r\nUsing `ngrx/effects` involves a custom decorator, `@Effects`. There are reports elsewhere in the Angular community that custom decorators are stripped from AoT builds in certain conditions (see [here](https://github.com/rangle/angular-2-aot-sandbox#ngrx-effects-top)).\r\n\r\nHere is an output of the compiled `effects/counter.ts` module in 0.0.46 and 0.0.47. Notice that the decorators are preserved in the former but stripped in the latter.\r\n\r\n**0.0.46**\r\n\r\n```\r\nfunction(module, exports, __webpack_require__) {\r\n\r\n\"use strict\";\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ngrx_effects__ = __webpack_require__(254);\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_map__ = __webpack_require__(538);\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_map__);\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__reducers_counter__ = __webpack_require__(104);\r\n/* harmony export (binding) */ __webpack_require__.d(exports, \"a\", function() { return CounterEffects; });\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n    if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n    return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar __metadata = (this && this.__metadata) || function (k, v) {\r\n    if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\r\n};\r\n\r\n\r\n\r\n\r\nvar CounterEffects = (function () {\r\n    function CounterEffects(actions$) {\r\n        this.actions$ = actions$;\r\n        this.reset$ = this.actions$\r\n            .ofType(__WEBPACK_IMPORTED_MODULE_3__reducers_counter__[\"c\" /* RESET */])\r\n            .map(function () { return ({ type: __WEBPACK_IMPORTED_MODULE_3__reducers_counter__[\"d\" /* RESET_SUCCESS */] }); });\r\n    }\r\n    CounterEffects.decorators = [\r\n        { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__[\"c\" /* Injectable */] },\r\n    ];\r\n    /** @nocollapse */\r\n    CounterEffects.ctorParameters = [\r\n        { type: __WEBPACK_IMPORTED_MODULE_1__ngrx_effects__[\"a\" /* Actions */], },\r\n    ];\r\n    __decorate([\r\n        __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__ngrx_effects__[\"b\" /* Effect */])(), \r\n        __metadata('design:type', Object)\r\n    ], CounterEffects.prototype, \"reset$\", void 0);\r\n    return CounterEffects;\r\n}());\r\n```\r\n\r\n**0.0.47**\r\n\r\n```\r\nfunction(module, exports, __webpack_require__) {\r\n\r\n\"use strict\";\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_rxjs_add_operator_map__ = __webpack_require__(534);\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_rxjs_add_operator_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_rxjs_add_operator_map__);\r\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__reducers_counter__ = __webpack_require__(178);\r\n/* harmony export (binding) */ __webpack_require__.d(exports, \"a\", function() { return CounterEffects; });\r\n\r\n\r\nvar CounterEffects = (function () {\r\n    function CounterEffects(actions$) {\r\n        this.actions$ = actions$;\r\n        this.reset$ = this.actions$\r\n            .ofType(__WEBPACK_IMPORTED_MODULE_1__reducers_counter__[\"a\" /* RESET */])\r\n            .map(function () { return ({ type: __WEBPACK_IMPORTED_MODULE_1__reducers_counter__[\"b\" /* RESET_SUCCESS */] }); });\r\n    }\r\n    return CounterEffects;\r\n}());\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/driftyco/ionic-app-scripts/issues/comments/267027062","html_url":"https://github.com/driftyco/ionic-app-scripts/issues/545#issuecomment-267027062","issue_url":"https://api.github.com/repos/driftyco/ionic-app-scripts/issues/545","id":267027062,"user":{"login":"iron9light","id":64274,"avatar_url":"https://avatars.githubusercontent.com/u/64274?v=3","gravatar_id":"","url":"https://api.github.com/users/iron9light","html_url":"https://github.com/iron9light","followers_url":"https://api.github.com/users/iron9light/followers","following_url":"https://api.github.com/users/iron9light/following{/other_user}","gists_url":"https://api.github.com/users/iron9light/gists{/gist_id}","starred_url":"https://api.github.com/users/iron9light/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iron9light/subscriptions","organizations_url":"https://api.github.com/users/iron9light/orgs","repos_url":"https://api.github.com/users/iron9light/repos","events_url":"https://api.github.com/users/iron9light/events{/privacy}","received_events_url":"https://api.github.com/users/iron9light/received_events","type":"User","site_admin":false},"created_at":"2016-12-14T12:56:43Z","updated_at":"2016-12-14T12:56:43Z","body":"Maybe you're right.\r\nBut after I use my private version of ngrx/effects which will not depend on any decorator, everything works again.\r\nIt's a bug anyway, no matter whose. ;-)"}}
{"actor":{"display_login":"iron9light"}}