Skip to content

tsickle pass is not active during --dev builds #5670

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

Closed
IgorMinar opened this issue Mar 26, 2017 · 6 comments
Closed

tsickle pass is not active during --dev builds #5670

IgorMinar opened this issue Mar 26, 2017 · 6 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@IgorMinar
Copy link
Contributor

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 6.9.5
os: darwin x64
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.0

Repro steps.

  • ng g s simple
  • ng serve or ng build
  • inspect the output

Desired functionality.

the main.js should contain decorators lowered into static properties:

"use strict";
var SimpleService = (function () {
    function SimpleService() {
        this.name = 'simple-service';
    }
    return SimpleService;
}());

currently it contains the reflect-metadata bloat which slows down build/browser load and allows apps to use functionality that won't be working on --prod mode:

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(11);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SimpleService; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    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;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};

var SimpleService = (function () {
    function SimpleService() {
        this.name = 'simple-service';
    }
    return SimpleService;
}());
SimpleService = __decorate([
    __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["e" /* Injectable */])()
], SimpleService);

//# sourceMappingURL=service-simple.js.map

Mention any other details that might be useful.

Usually I enable the tsickle pass via

  "angularCompilerOptions": {
    "annotationsAs": "static fields"
  }

but that has no effect if entered into src/app/tsconfig.app.json

@hansl
Copy link
Contributor

hansl commented Mar 26, 2017

We do not use tsickle. What we do is look if a decorator is from @angular/* (seems like it should be in your case), and remove it.

Do you have a project we can clone and look at?

@hansl hansl added the needs: more info Reporter must clarify the issue label Mar 26, 2017
@IgorMinar
Copy link
Contributor Author

any brand new 1.0.0 + A4 project does this in my experience

@filipesilva
Copy link
Contributor

Does the annotationAs option work on a dev build with aot enabled? e.g. ng build --aot

@fkolar
Copy link

fkolar commented Jul 27, 2017

@filipesilva I dont see it working. Is this supposed to be working?
But you dont use tsc-wrapped right? Which already include tsickle and also check these :

"angularCompilerOptions": {
      "strictMetadataEmit": true,
      "annotationsAs": "static fields",
      "annotateForClosureCompiler": true
    }

@fkolar
Copy link

fkolar commented Jul 29, 2017

Please see #6992

@hansl hansl removed their assignment Feb 6, 2018
@hansl hansl closed this as completed Aug 23, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

4 participants