Skip to content
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

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

Open
b0lle opened this issue Jun 27, 2020 · 5 comments

Comments

@b0lle
Copy link

b0lle commented Jun 27, 2020

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"
        ],
@nilot111
Copy link

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

@rmartin-sommset
Copy link

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

@Nickholas
Copy link

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

@Stan92
Copy link

Stan92 commented Mar 8, 2022

ditto

@mirateOfficial
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants