question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build optimizer after optimize not a function error

See original GitHub issue

From @Mightforanis1938 on February 16, 2018 14:20

Bug Report or Feature Request (mark with an x)

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

Area

- [x ] devkit
- [ ] schematics

Versions

node --version v8.9.4 npm --version 5.6.0

Repro steps

I have an angular module with an observable timer

private scheduleRefresh() {
       const source = this.tokenStream.flatMap(
           token => {
               return Observable.timer(5000);
           });

       // Once the delay time from above is
       // reached, get a new JWT and schedule
       // additional refreshes
       source.subscribe(() => {
           this.getNewJwt();
       });
   }

module Inports:

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/of';
import 'rxjs/add/observable/timer';
import { Injectable, Injector } from '@angular/core';
import { Router } from '@angular/router';
import { TranslationService } from 'angular-l10n';
import { JwtHelperService } from '@auth0/angular-jwt'
import { UILocalStorageOption, UIStateService } from 'app/core/service/uiState.service';
import { PasswordReset } from 'app/userprofile/model/passwordreset';
import { environment } from 'environments/environment';
import { ToastrService } from 'ngx-toastr';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { ActionError } from 'app/shared/actionError';
import { HttpClient, HttpResponse, HttpHeaders } from '@angular/common/http';
import { HttpErrorResponse } from '@angular/common/http/src/response';

and after build with build optimizer:

 t.prototype.scheduleRefresh = function() {
                var t = this;
                this.tokenStream.flatMap(function(t) {
                    return o.a.timer(5e3)
                }).subscribe(function() {
                    t.getNewJwt()
                })
            }

The log given by the failure

message: “o.a.timer is not a function” stack: “TypeError: o.a.timer is not a function”

It works when the set to --build-optimizer=false but when is turned on and after the build when the scheduleRefresh is called throws a not a function error

"dependencies": {
        "@angular/animations": "5.1.3",
        "@angular/cdk": "5.0.3",
        "@angular/common": "5.1.3",
        "@angular/compiler": "5.1.3",
        "@angular/core": "5.1.3",
        "@angular/forms": "5.1.3",
        "@angular/http": "5.1.3",
        "@angular/material": "5.0.3",
        "@angular/platform-browser": "5.1.3",
        "@angular/platform-browser-dynamic": "5.1.3",
        "@angular/router": "5.1.3",
        "@types/lodash": "4.14.91",
        "@types/moment": "2.13.0",
        "@types/jquery": "3.2.17",
        "@types/quill": "1.3.5",
        "@auth0/angular-jwt": "1.0.0-beta.9",
        "angular-cropperjs": "0.1.5",
        "angular-l10n": "4.1.3",
        "angular-tree-component": "5.2.1",
        "angular2-moment": "1.7.1",
        "angular2-recaptcha": "0.4.1",
        "bootstrap": "3.3.7",
        "core-js": "2.5.3",
        "devextreme": "17.2.4",
        "devextreme-angular": "17.2.4",
        "devextreme-intl": "17.2.4",
        "fast-json-patch": "2.0.6",
        "file-saver": "1.3.2",
        "font-awesome": "4.7.0",
        "jquery": "3.2.1",
        "js2xmlparser": "3.0.0",
        "metismenu": "2.7.2",
        "mobx-angular": "1.9.0",
        "ng-sidebar": "6.0.5",
        "ngx-quill": "2.1.1",
        "ngx-toastr": "7.0.0",
        "rxjs": "5.5.6",
        "web-animations-js": "2.3.1",
        "xlsx": "0.11.2",
        "zone.js": "0.8.19"
    },
    "devDependencies": {
        "@angular-devkit/build-optimizer": "0.3.1",
        "@angular/cli": "1.6.3",
        "@angular/compiler-cli": "5.1.3",
        "@angular/language-service": "5.1.3",
        "@types/jasmine": "2.5.54",
        "@types/metismenu": "2.7.1",
        "@types/node": "6.0.95",
        "codelyzer": "4.0.2",
        "concurrently": "3.5.1",
        "jasmine-core": "2.8.0",
        "jasmine-spec-reporter": "4.1.1",
        "karma": "1.7.1",
        "karma-chrome-launcher": "2.1.1",
        "karma-cli": "1.0.1",
        "karma-coverage-istanbul-reporter": "1.3.3",
        "karma-jasmine": "1.1.1",
        "karma-jasmine-html-reporter": "0.2.2",
        "node-sass": "4.7.2",
        "protractor": "5.1.2",
        "ts-node": "3.2.2",
        "tslint": "5.3.2",
        "typescript": "2.5.3",
        "webpack-bundle-analyzer": "2.9.1"
    }

it does not work with “@angular-devkit/build-optimizer”: “0.4.0” either. image

Copied from original issue: angular/devkit#443

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Dec 31, 2018

Thanks for reporting this issue. However, you didn’t provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we can’t act on issues that are lacking important information.

If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

build optimizer after optimize not a function error #443 - GitHub
stack: "TypeError: o.a.timer is not a function". It works when the set to --build-optimizer=false but when is turned on and after the build ......
Read more >
Angular build optimizer - TypeError: this._createContainer is ...
5 application with --prod produces a strange run-time error. The stack-trace is. ERROR TypeError: this._createContainer is not a function at ...
Read more >
Optimizer Error and Warning Messages - FICO
This function returns information related to the error code, held in the problem attribute ERRORCODE. For Console users the value of this attribute...
Read more >
Optimize Options (Using the GNU Compiler Collection (GCC))
Without any optimization option, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results.
Read more >
Error: tree.render is not a function - HTML-CSS
I faced same problem. For not blocked here, I found a way. parcel build --no-minify index.html. It will jump the optimization of parcel ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found