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

Module not found #5

Closed
sergio11 opened this issue Mar 9, 2016 · 4 comments
Closed

Module not found #5

sergio11 opened this issue Mar 9, 2016 · 4 comments

Comments

@sergio11
Copy link

sergio11 commented Mar 9, 2016

hi there,

i am finding problems at use it wit webpack

ERROR in multi vendor Module not found: Error: Cannot resolve module 'angular2-notifications' in C:\Us ers\Sergio_2\auth-angular2-app @ multi vendor

here is the webpack config fragment
entry: { 'vendor': [ // Polyfills 'es6-shim', 'es6-promise', 'reflect-metadata', 'zone.js/dist/zone-microtask', 'zone.js/dist/long-stack-trace-zone', // Angular2 'angular2/platform/browser', 'angular2/platform/common_dom', 'angular2/core', 'angular2/router', 'angular2/http', // RxJS 'rxjs', // Other 'angular2-jwt', 'angular2-notifications' ], 'app': [ './src/index' ] }

@flauc
Copy link
Owner

flauc commented Mar 9, 2016

To be honest i'we only ever used system.js with my angular2 applications. But i'll have a look and let you know.

@flauc
Copy link
Owner

flauc commented Mar 9, 2016

I've managed to make it work with webpack. It was actually quit simple. All i did was clone this repo:

Angular2-webpack-starter

Installed the library
npm install angular2-notifications

And modified:

home.ts

import {Component, OnInit} from 'angular2/core';
import {FORM_DIRECTIVES} from 'angular2/common';
import {SimpleNotificationsComponent, NotificationsService} from 'angular2-notifications/components'

@Component({
  selector: 'home',
  directives: [SimpleNotificationsComponent],
  pipes: [],
  styles: [require('./home.scss')],
  template: require('./home.html')
})
export class Home implements OnInit {
  constructor(private _service: NotificationsService) {}
  public options = {
    timeOut: 5000,
    lastOnBottom: true
  };

  create() {
    this._service.success('bla', 'example')
  }
}

bootstrap.ts

...
import {NotificationsService} from 'angular2-notifications/components'
...
  return bootstrap(App, [
    ...
    NotificationsService,
    ...
});

And home.html

<simple-notifications [options]="options"></simple-notifications>
<button (click)="create()"></button>

It's all working but the css is a little broken. There might be some overlaps.

@sergio11
Copy link
Author

thanks for response.

I will follow you suggestion with Angular2-webpack-starter.

greetings

@flauc
Copy link
Owner

flauc commented Mar 10, 2016

np.. glad i could help.

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

2 participants