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

ng (build|serve) -prod #13

Closed
luma777 opened this issue Jun 7, 2017 · 5 comments
Closed

ng (build|serve) -prod #13

luma777 opened this issue Jun 7, 2017 · 5 comments
Assignees
Labels

Comments

@luma777
Copy link

luma777 commented Jun 7, 2017

When I use "ng serve" I have no problem, but when I use "-prod" option I have this warnings on build.

WARNING in ./src/$$_gendir/~/ng-snotify/ng-snotify.ngfactory.ts
70:14-24 "export 'ɵa' (imported as 'import1') was not found in 'ng-snotify'

WARNING in ./src/$$_gendir/~/ng-snotify/ng-snotify.ngfactory.ts
489:37-47 "export 'ɵb' (imported as 'import1') was not found in 'ng-snotify'

WARNING in ./src/$$_gendir/~/ng-snotify/ng-snotify.ngfactory.ts
533:39-49 "export 'ɵa' (imported as 'import1') was not found in 'ng-snotify'

WARNING in ./src/$$_gendir/~/ng-snotify/ng-snotify.ngfactory.ts
538:59-69 "export 'ɵa' (imported as 'import1') was not found in 'ng-snotify'

WARNING in ./src/$$_gendir/~/ng-snotify/ng-snotify.ngfactory.ts
778:37-47 "export 'ɵb' (imported as 'import1') was not found in 'ng-snotify'

The notifications aren't show, on console browser I have this stack error.

vendor.108d939….bundle.js:197 ERROR TypeError: r is not a constructor
    at cn (vendor.108d939….bundle.js:281)
    at on (vendor.108d939….bundle.js:281)
    at Bn (vendor.108d939….bundle.js:309)
    at Object.Fn [as createEmbeddedView] (vendor.108d939….bundle.js:309)
    at e.createEmbeddedView (vendor.108d939….bundle.js:386)
    at t.createEmbeddedView (vendor.108d939….bundle.js:386)
    at vendor.108d939….bundle.js:106
    at t.forEachOperation (vendor.108d939….bundle.js:386)
    at t._applyChanges (vendor.108d939….bundle.js:106)
    at t.ngDoCheck (vendor.108d939….bundle.js:106)
    at sn (vendor.108d939….bundle.js:281)
    at Yn (vendor.108d939….bundle.js:309)
    at Gn (vendor.108d939….bundle.js:309)
    at dr (vendor.108d939….bundle.js:309)
    at Object.updateDirectives (vendor.108d939….bundle.js:858)

I imported and exported in ShareModule.

import { SnotifyModule, SnotifyService } from 'ng-snotify';

@NgModule({
    imports: [
        CommonModule,
        SnotifyModule
    ],
    exports: [
        SnotifyModule
    ],
    providers: [
        SnotifyService
    ],
    declarations: []
})

Here do you see my versions libraries.

@angular/cli: 1.1.0
node: 7.4.0
os: darwin x64
@angular/animations: 4.1.3
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/language-service: 4.1.3
@angular/material: 2.0.0-beta.6
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/compiler-cli: 4.1.3
@angular/cli: 1.1.0

Thank you for your project.

@artemsky
Copy link
Owner

artemsky commented Jun 7, 2017

Thank you for reporting! I really appreciate it.

Currently I'm researching this issue.

This happens because of aot compilation.

Temporarily solution is ng build --aot=false --prod

@luma777
Copy link
Author

luma777 commented Jun 7, 2017

Thanks for your temporary solution, it's work very well.

@artemsky artemsky added the bug label Jun 8, 2017
@artemsky
Copy link
Owner

artemsky commented Jun 8, 2017

according to jvandemo/generator-angular2-library#116 (thx @maychan111)

Next update, it should work with AOT compilation

artemsky added a commit that referenced this issue Jun 8, 2017
@artemsky artemsky closed this as completed Jun 8, 2017
@artemsky artemsky self-assigned this Jun 9, 2017
@tatsujb
Copy link

tatsujb commented Jun 22, 2018

I'm getting this today, why is that?

Date: 2018-06-22T10:04:13.172Z - Hash: 8dfa24488b39ef243e34 - Time: 10375ms
5 unchanged chunks
chunk {main} main.js, main.js.map (main) 16.2 MB [initial] [rendered]

WARNING in ./src/app/app.component.ngfactory.js
7:0-88 "export 'ɵb' (reexported as 'ɵb_5') was not found in 'ng-snotify'

WARNING in ./src/app/app.component.ngfactory.js
7:0-88 "export 'ɵc' (reexported as 'ɵc_6') was not found in 'ng-snotify'
i 「wdm」: Compiled with warnings.

I'll spare you my whole modules files but i made sure to have the entries in every section here :

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import {SnotifyModule, SnotifyService, ToastDefaults} from 'ng-snotify';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    SnotifyModule
  ],
  providers: [
    { provide: 'SnotifyToastConfig', useValue: ToastDefaults},
    SnotifyService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

as for my app.component.ts :

import { Component } from '@angular/core';
import {Observable} from 'rxjs';
import {SnotifyService, SnotifyPosition, SnotifyToastConfig} from 'ng-snotify';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {

  constructor(private snotifyService: SnotifyService) {
    setTimeout(() => {
      this.onAsyncLoading();
    }, 2000);
  }

  getConfig(): SnotifyToastConfig {
    this.snotifyService.setDefaults({
      global: {
        newOnTop: true,
        maxAtPosition: 6,
        maxOnScreen: 8,
      }
    });
    return {
      bodyMaxLength: 80,
      titleMaxLength: 15,
      backdrop: -1,
      position: SnotifyPosition.rightTop,
      timeout: 3000,
      showProgressBar: false,
      closeOnClick: true,
      pauseOnHover: true
    };
  }

  onSuccess() {
    this.snotifyService.success('Réussite', 'Réussite', this.getConfig());
  }
  onInfo() {
    this.snotifyService.info('Information', 'Information', this.getConfig());
  }
  onError() {
    this.snotifyService.error('Erreur', 'Erreur', this.getConfig());
  }
  onWarning() {
    this.snotifyService.warning('Warning', 'Warning', this.getConfig());
  }

  onAsyncLoading() {
    const errorAction = Observable.create(observer => {
      setTimeout(() => {
        observer.error({
          title: 'Error',
          body: 'Example. Error 404. Service not found',
        });
      }, 2000);
    });

    const successAction = Observable.create(observer => {
      setTimeout(() => {
        observer.next({
          body: 'Still loading.....',
        });
      }, 2000);

      setTimeout(() => {
        observer.next({
          title: 'Success',
          body: 'Example. Data loaded!',
          config: {
            closeOnClick: true,
            timeout: 5000,
            showProgressBar: true
          }
        });
        observer.complete();
      }, 5000);
    });
    const {timeout, ...config} = this.getConfig(); // Omit timeout
    this.snotifyService.async('This will resolve with error', 'Async', errorAction, config);
    this.snotifyService.async('This will resolve with success', successAction, config);
    this.snotifyService.async('Called with promise', 'Error async',
      new Promise((resolve, reject) => {
        setTimeout(() => reject({
          title: 'Error!!!',
          body: 'We got an example error!',
          config: {
            closeOnClick: true
          }
        }), 1000);
        setTimeout(() => resolve(), 1500);
      }), config);
  }

}

and my html :

<div class="main">
  <app-logged-in class="logged-in"></app-logged-in>
</div>
<ng-snotify class="material"></ng-snotify>

I am compiling in aot.

EDIT :

but if I add the --aot=false flag I don't get this error.

here's my package.json :

{
  "name": "web.ui",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve  --aot  --proxy-config proxy.json",
    "build": "ng b --prod",
    "test": "ng test",
    "lint": "ng lint"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.4",
    "@angular/cdk": "^6.2.1",
    "@angular/common": "^6.0.4",
    "@angular/compiler": "^6.0.4",
    "@angular/core": "^6.0.4",
    "@angular/forms": "^6.0.4",
    "@angular/http": "^6.0.4",
    "@angular/material": "^6.2.1",
    "@angular/platform-browser": "^6.0.4",
    "@angular/platform-browser-dynamic": "^6.0.4",
    "@angular/router": "^6.0.4",
    "@ncstate/sat-popover": "^2.1.1",
    "@ngx-translate/i18n-polyfill": "^1.0.0",
    "@types/underscore": "^1.8.7",
    "angular-font-awesome": "^3.1.2",
    "bootstrap": "^4.1.1",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.3",
    "file-saver": "^1.3.8",
    "font-awesome": "^4.7.0",
    "iconv-lite": "^0.4.23",
    "jquery": "^3.3.1",
    "lodash": "^4.17.5",
    "ng-snotify": "^4.3.1",
    "ng2-ion-range-slider": "^2.0.0",
    "ngx-bootstrap": "^3.0.0",
    "ngx-dropzone-wrapper": "^6.1.0",
    "popper.js": "^1.14.3",
    "rxjs": "^6.2.0",
    "typescript": "2.7.2",
    "underscore": "^1.9.1",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.20"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^6.0.4",
    "@angular/language-service": "^6.0.4",
    "@types/jasmine": "^2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~10.3.2",
    "codelyzer": "^4.2.1",
    "postcss-modules": "^1.1.0",
    "protractor": "~5.3.0",
    "ts-node": "~6.1.0",
    "tslint": "~5.10.0"
  }
}

@tatsujb
Copy link

tatsujb commented Jun 22, 2018

the --aot was causing it. I remember i had to use it in angular 5 to be in AOT mode on ng serve not sure if that's still the case in angular 6.

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

No branches or pull requests

3 participants