tinesoft/ngx-cookieconsent

TypeError: Cannot read property 'initialise' of undefined - only in production

b0lle opened this issue · 5 comments

b0lle commented

Bug Report or Feature Request (mark with an x)

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

CookieConsent and Library Versions?

- cookieconsent version: ^3.1.1
- ngx-cookieconsent version:^2.2.3"

OS Version?

macOS.Catalina

Angular, Node and al Versions?

Angular CLI: 9.1.8
Node: 10.15.3
OS: darwin x64

Angular: 9.1.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.901.8
@angular-devkit/build-angular 0.901.8
@angular-devkit/build-optimizer 0.901.8
@angular-devkit/build-webpack 0.901.8
@angular-devkit/core 9.1.8
@angular-devkit/schematics 9.1.8
@angular/cdk 9.2.4
@angular/cli 9.1.8
@angular/material 9.2.4
@ngtools/webpack 9.1.8
@schematics/angular 9.1.8
@schematics/update 0.901.8
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0

Repro steps

The log given by the failure

vendor.js:1 ERROR TypeError: Cannot read property 'initialise' of undefined
at t.init (vendor.js:1)
at new t (vendor.js:1)
at Object.t.ɵfac [as factory] (vendor.js:1)
at t.hydrate (vendor.js:1)
at t.get (vendor.js:1)
at e.get (vendor.js:1)
at Object.get (vendor.js:1)
at pn (vendor.js:1)
at Object.$o (vendor.js:1)
at Object.e.ɵfac [as factory] (main.js:1)

Mention any other details that might be useful

If I run ng serve the application will be displayed correctly.
This error only happens in production, when running
ng build --aot --prod --build-optimizer=true --vendor-chunk=true --output-hashing=none

This is from my angular.json so you can verify that the js files are linkes correctly:

        "styles": [
          "src/assets/styles/styles.css",
          "./node_modules/cookieconsent/build/cookieconsent.min.css"
        ],
        "scripts": [
          "./node_modules/cookieconsent/build/cookieconsent.min.js"
        ],

is there any update ? . I am having same issue running angular universa.

I am also running into the same problem, without using universal and without being in production.

Me too. I get "error typeerror this.cookieconsent is undefined" when i run on production. In develop mode (running on localhost) it works fine.

ditto

I'm getting "error typeerror this.cookieconsent is undefined" in dev and prod